cometd-java-client graceful termination

82 views
Skip to first unread message

Flo

unread,
Feb 5, 2013, 8:36:41 AM2/5/13
to cometd...@googlegroups.com
Hi,

I noticed another thing after upgrading to the latest cometd/jetty libs in an old project (that was on cometd 2.3.1 before). Previously, the default thread pools were started as daemon threads. Not anymore. Now my java client cannot terminate itself gracefully anymore. Ok, the LongPollingTransport can be configured with a daemon thread pool. The websocket client (9.0.0.RC0), however, instantiates a ScheduledExecutorScheduler without daemon threads internally. There is no way to reconfigure it. What is the rationale behind? And the solution? Should I ask the jetty people to make the websocket client more configurable? Or is it better to include kind of a shutdown method in BayeuxClient that calls stop() on all registered transports?

Best Regards,
Florian

Simone Bordet

unread,
Feb 19, 2013, 6:45:22 AM2/19/13
to cometd-users
Florian,

sorry it took so long to respond.
Jetty never starts the QueuedThreadPool in daemon mode.
The Jetty HttpClient does configure explicitly the thread pool to be
daemon if no thread pool is configured by the application.
So, if you refer to differenced between 2.3.x and 2.5.x/2.6.x there
should be none.
If you have a difference, please report exact CometD and Jetty versions.

In Jetty 9, HttpClient does not configure the thread pool as daemon.
This is on purpose, and if you want to stop it, you need to call
HttpClient.stop().
In CometD 3, the HttpClient and the WebSocketClient are provided
externally, so you need to call stop() on them explicitly when you're
finished.

--
Simone Bordet
----
http://cometd.org
http://webtide.com
http://intalio.com
Developer advice, training, services and support
from the Jetty & CometD experts.
Intalio, the modern way to build business applications.
Reply all
Reply to author
Forward
0 new messages