Hi Romilly, The task service is managing a pool of threads via the ExecutorService interface, which is recommended over straight threads. It allows changing the threading policy without impacting application code. It also has a proper shutdown mechanism which is hooked to the Component life cycle. However, in your case, it does seem to complicate things too much. Best regards, Jerome Louvel -- Restlet ~ Founder and Lead developer ~ <http://www.restlet.org/> http://www.restlet.org Noelios Technologies ~ Co-founder ~ <http://www.noelios.com/> http://www.noelios.com
_____ De : Romilly Cocking [mailto:[email protected]] Envoyé : lundi 16 mars 2009 15:39 À : [email protected] Objet : Re: InterruptedException when stopping component Thanks, Jerome, It's good to know I was not too far off course. What is the benefit of using the Application's getTaskService method, as opposed to creating a Thread myself and then starting my component-stopper? I'm currently just using a Component + some Restlets, and would prefer not to create an Application if I don't need to. As a bit of background, I'm planning to use the Restlet framework in getinline2, an embedded Java DSL for record-oriented processing. I've been very impressed by what I've seen so far. Regards,� Romilly 2009/3/16 Jerome Louvel <[email protected]> Hi Romilly, Your first solution doesn't work because when you stop the component, it stops the connectors and shuts downs the active socket connections including the one serving your shutdown request. Your second solution sounds good to me. Make sure you leverage the Application#taskService to get your new thread. Best regards, Jerome Louvel -- Restlet ~ Founder and Lead developer ~ http://www.restlet.org Noelios Technologies ~ Co-founder ~ http://www.noelios.com -----Message d'origine----- De : Romilly Cocking [mailto:[email protected]] Envoy� : dimanche 15 mars 2009 12:24 � : [email protected] Objet : RE: InterruptedException when stopping component I've found a workaround; I start another thread and send stop() to the container after a 100 ms delay. It works, but it's not pretty. Is there a better solution? ------------------------------------------------------ http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447 <http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=13264> &dsMessageId=13264 44 ------------------------------------------------------ http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447 <http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=1333512> &dsMessageId=1333512 ------------------------------------------------------ http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=1339515

