Forum: JRuby Grizzly execute Thread start

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.
Paul F. (Guest)
on 2009-04-09 19:05
(Received via mailing list)
This code in a Grizzly execute method
new Thread(controller).start();
starts the thread running and terminates the thread when the controller
is stopped later on in the code. (I think)
In JRuby, something like..
Thread.new do
.......
end

Presumably at the end of the block the thread would terminate, not what
we want.
How is this handled in JRuby?

Thanks
Paul F.

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

    http://xircles.codehaus.org/manage_email
Bill D. (Guest)
on 2009-04-11 01:03
(Received via mailing list)
The only real difference is that the JRuby Thread won't automatically
start
your Runnable controller, so you'll have to do it manually:

  # assuming you've already assigned the controller
  # instance to instance variable '@controller'

  Thread.new do
    @controller.run
  end

You could also just use a raw Java thread, e.g.

  java.lang.Thread.new(@controller).start

but probably best to stick with JRuby threads.

-Bill
This topic is locked and can not be replied to.