O'Reilly logo

Sun Certification Training Guide (310-025, 310-027): Java™ 2 Programmer and Developer Exams by Jamie Jaworski

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Synchronization

Multiple threads often must share access to common objects. For example, Listings 8.1 and 8.2 illustrate the effects of multithreading by having multiple executing threads write to the Java console, a common shared object. These examples do not require coordination or synchronization in the way the threads access the console window: Whichever thread is currently executing is able to write to the console window.

Sometimes you might want to coordinate access to shared resources. For example, in a database system, you might not want one thread to be updating a database record while another thread is trying to read it. Java enables you to coordinate the actions of multiple threads using synchronized methods and synchronized statements. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required