File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How synchronize between Threads ?

 
Mark Guo
Ranch Hand
Posts: 58
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How synchronize between Threads ?
 
Jagdish Hatagale
Ranch Hand
Posts: 33
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
make the current executing object Synchronized
like Synchronized(this) and write the block of code in it.
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6109
6
Android IntelliJ IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic