Java Synchronize in JRuby


#1

Trying some JXTA sample code in JRuby but stuck on how to handle the
following code.
How is “synchronized” handled in JRuby?

synchronized(shutDown) {
try {
while(!stopped) {
shutDown.wait(5000);

}
} catch( InterruptedException woken ) {
Thread.interrupted();
}
}

Thanks
Paul F.


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

#2

Paul F. wrote:

               Thread.interrupted();
           }
       }

You would use the thread library for general synchronization:

http://www.ruby-doc.org/stdlib/libdoc/thread/rdoc/classes/Mutex.html

I’d like there to be a synchronize on arbitrary objects, but I’ve been
educated that that encourages bad locking patterns.

  • Charlie

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email