aspose file tools*
The moose likes Threads and Synchronization and the fly likes How synchronize between Threads ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "How synchronize between Threads ?" Watch "How synchronize between Threads ?" New topic
Author

How synchronize between Threads ?

Mark Guo
Ranch Hand

Joined: Nov 17, 2010
Posts: 58
How synchronize between Threads ?
Jagdish Hatagale
Ranch Hand

Joined: Apr 07, 2010
Posts: 33
make the current executing object Synchronized
like Synchronized(this) and write the block of code in it.
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

Jagdish Hatagale wrote:make the current executing object Synchronized
like Synchronized(this) and write the block of code in it.


No. that's not it. First, you can't "make an object synchronized". Second writing a block of code in a synced object doesn't by itself accomplish syncing between threads.
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

Mark Guo wrote:How synchronize between Threads ?


Without a more specific question, the best answer I can give is to google for java concurrency tutorial or check out Bian Goetz's Java Concurrency in Practice or Doug Lea's Concurrent Programming in Java. Or perpahs to say, "Using the synchronized keyword," as the other respondent did, but that doesn't really answer your question, I imagine.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How synchronize between Threads ?