You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@mina.apache.org by "Bergman, Yosi" <Yo...@bmc.com> on 2010/04/07 10:10:20 UTC
How to make threads as setDaemon() in Mina 1.1.7
Hi,
I saw a couple of messages but could not find any answer.
(http://old.nabble.com/Mina-Client-Quick-Shutdown-ts21417062.html#a21417062)
How do I make all MINA threads (especially IoHandler) a daemon thread ?
Even just for development reasons, I want the process to shutdown once the main (user) thread is terminating.
Thanks.
Yosi.
Re: How to make threads as setDaemon() in Mina 1.1.7
Posted by Shaun Senecal <ss...@gmail.com>.
I was facing the same issue, and I think the answer is that when you
create your SocketCreator(), you also pass in an Executor
implementation. By doing that, you can control how the Threads are
being created, and make them into daemon threads.
Take a look at:
http://docs.huihoo.com/javadoc/apache/mina/1.1.7/org/apache/mina/transport/socket/nio/SocketConnector.html#SocketConnector%28int,%20java.util.concurrent.Executor%29
Shaun
On Wed, Apr 7, 2010 at 11:10 PM, David Rosenstrauch <da...@darose.net> wrote:
> On 04/07/2010 04:10 AM, Bergman, Yosi wrote:
>>
>> Hi,
>>
>> I saw a couple of messages but could not find any answer.
>>
>> (http://old.nabble.com/Mina-Client-Quick-Shutdown-ts21417062.html#a21417062)
>> How do I make all MINA threads (especially IoHandler) a daemon thread ?
>> Even just for development reasons, I want the process to shutdown once the
>> main (user) thread is terminating.
>>
>> Thanks.
>>
>> Yosi.
>
> ? Aren't they already?
>
> Here's what I do to shut down my Mina server:
>
> at startup:
> ...
> protocolAcceptor = new NioSocketAcceptor();
> ...
> protocolAcceptor.bind();
> ...
>
>
>
> at shutdown:
> ...
> protocolAcceptor.unbind();
> protocolAcceptor.dispose();
> ...
>
>
> The process seems to shut down fine after that.
>
> DR
>
Re: How to make threads as setDaemon() in Mina 1.1.7
Posted by David Rosenstrauch <da...@darose.net>.
On 04/07/2010 04:10 AM, Bergman, Yosi wrote:
> Hi,
>
> I saw a couple of messages but could not find any answer.
> (http://old.nabble.com/Mina-Client-Quick-Shutdown-ts21417062.html#a21417062)
> How do I make all MINA threads (especially IoHandler) a daemon thread ?
> Even just for development reasons, I want the process to shutdown once the main (user) thread is terminating.
>
> Thanks.
>
> Yosi.
? Aren't they already?
Here's what I do to shut down my Mina server:
at startup:
...
protocolAcceptor = new NioSocketAcceptor();
...
protocolAcceptor.bind();
...
at shutdown:
...
protocolAcceptor.unbind();
protocolAcceptor.dispose();
...
The process seems to shut down fine after that.
DR