aspose file tools*
The moose likes Threads and Synchronization and the fly likes thread synchronization query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "thread synchronization query" Watch "thread synchronization query" New topic
Author

thread synchronization query

Abhishek Purwar
Ranch Hand

Joined: Dec 15, 2007
Posts: 63

Hi,

I have query for thread synchronization.

Suppose there are three threads and there is one method which takes number as input and prints number.
If threads passes same number, number should print one time and if different numbers provided as input then all different number should print.

For e.g.
If thread1 and thread2 passes 1 as input to method and thread 3 passes 2 as input then 1 should print once and 2 should print once.
If thread 1 passes 1, thread 2 passes 2 and thread 3 passes 3 then all number should get printed as all are different.

Please suggest me how I shall achieve this.

Regards,
Abhishek


Abhishek Purwar,
Bangalore.
Jelle Klap
Bartender

Joined: Mar 10, 2008
Posts: 1763
    
    7

How would you approach it and why? Think about it for a bit and then try coming up with an SSCCE you can post here.


Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: thread synchronization query