Is there a way in Java to check whether an object is locked (i.e. some thread has it) in a non-blocking fashion?

Alex Chaffee

No, no, and no. :-)

If you want more sophisticated control over concurrency in your application, you can implement your own Lock class, built on top of the synchronized keyword. Such a class can implement timeouts, back-off strategies, and the like. The O'Reilly Threads book by Oaks and Wong has an example of doing this. Unfortunately, this would only work for your own classes, not for classes you call that use the standard Java mechanisms.