• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Confusion in Lock Interface

 
vivek dhiman
Ranch Hand
Posts: 153
Netbeans IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I have doubt to understand how lock works to maintain synchronization. I had the sample code which i was trying to implement synchronization using Lock. But it doesn't work.

Client Class

I want unique values till 300 in value.txt. Please tell me where i am wrong.
Thanks
 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
vivek dhiman wrote:...But it doesn't work.
...
I want unique values till 300 in value.txt. Please tell me where i am wrong.

You need to learn to describe your problems better. ItDoesntWorkIsUseless (<- link). We know what you want, but what happens that you don't expect or what error messages do you get?


You create a new lock every time the method is called. So how do you expect it to synchronize?
 
vivek dhiman
Ranch Hand
Posts: 153
Netbeans IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Steve. Now txt file have unique values till 300.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic