This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Implementing Lock interface  RSS feed

 
Toni Lane
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are there any good examples on implementing the Lock interface?
 
Campbell Ritchie
Sheriff
Posts: 53747
127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why would you want to implement the interface youirself?

Question too difficult for “beginning”; this question would fit better in our Threading forum.
 
Toni Lane
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:Why would you want to implement the interface youirself?

Question too difficult for “beginning”; this question would fit better in our Threading forum.

Well, I was learning concurrency and i thought that I shouldn't skip java Locks until i have successfully implemented my own CustomLock.
I didn't know that beginners aren't expected to know that.


however, should this thread be moved? or do i make a new thread? or should i just skip this to the next concurrency topic (as a beginner)?
 
Henry Wong
author
Sheriff
Posts: 22833
119
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Toni Lane wrote:Are there any good examples on implementing the Lock interface?


Well, on one hand, the core Java library is provided as source code. So, if you are interested in how the library implements the built in lock classes, then you can actually see the source code. On the other hand, the library implements the locks optimistically, which can be very complex. I am not sure if beginners can gain much by trying to use them as examples.

Regardless, it can't hurt to take a look.

Toni Lane wrote:
however, should this thread be moved? or do i make a new thread? or should i just skip this to the next concurrency topic (as a beginner)?


It looks like Campbell already moved this topic to the threads forum for you.

Henry
 
Toni Lane
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the responses. I think i will leave it for later then.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!