File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes synchronize variable by lock Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "synchronize variable by lock" Watch "synchronize variable by lock" New topic

synchronize variable by lock

Stefan Müllerheim

Joined: Sep 17, 2010
Posts: 12
hi, i try to synchronize the access to a variable and wrote something below. is that correct? see anybody any fault?

less is more.
Henry Wong

Joined: Sep 28, 2004
Posts: 20370

BTW, there is no need to create a new local variable...


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
jQuery in Action, 3rd edition
subject: synchronize variable by lock
It's not a secret anymore!