Forum: JRuby Java Synchronize in JRuby

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
7152eafe55a8df6d712fb39691d768df?d=identicon&s=25 Paul Fraser (paulfras)
on 2008-10-15 17:42
(Received via mailing list)
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);
                        <snip>
                    }
                } catch( InterruptedException woken ) {
                    Thread.interrupted();
                }
            }

Thanks
Paul Fraser


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
Ede2aa10c6462f1d825143879be59e38?d=identicon&s=25 Charles Oliver Nutter (Guest)
on 2008-10-15 20:31
(Received via mailing list)
Paul Fraser wrote:
>                    Thread.interrupted();
>                }
>            }

You would use the thread library for general synchronization:

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

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
This topic is locked and can not be replied to.