Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Lock Objects  RSS feed

 
praveen kumaar
Ranch Hand
Posts: 461
22
Android Chrome Eclipse IDE Google App Engine Java Notepad Oracle Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey can anyone explain me the role of lock object here and also the statement inside try catch block(in bow method),impendingBow method.

please help
 
Henry Wong
author
Sheriff
Posts: 23283
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

The purpose of the lock (and there are two of them) is to make sure both parties are available for the action. If the code can acquire both locks, then the action is taken, and the locks are released.

As for the impendingBow() method, that code is simply to acquire both locks prior to calling the code for the action.

Henry
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!