You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Andrey Nechet <ne...@hotmail.com> on 2006/11/03 09:45:51 UTC

Close session ?

Hi,

I would like to use Mina for simple client connection.
Simplified code:
		IoConnector connector = new SocketConnector();
		SocketAddress socketAddress = new InetSocketAddress(config.getHost(),
				config.getPort());
		try {
			ConnectFuture future = connector.connect(socketAddress,
					new IoHandler(){....});

			future.join();
			IoSession session = future.getSession();
			session.close();
		} catch (IOException e) {
			e.printStackTrace();
		}

Question:
After future.join() I have the next additional Threads in debugger:
Thread [AnonymousIoService-1-1] (Running)
Thread [SocketIoProcessor-0] (Running)
Thread [AnonymousIoService-1-2] (Running)
Thread [PooledByteBufferExpirer-0] (Running)

All seems OK. But after sesson.close() only one Thread [SocketIoProcessor-0] 
terminated.
How I can terminate another threads?

Regards,
Andrey

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


Re: Close session ?

Posted by Trustin Lee <tr...@gmail.com>.
On 11/3/06, Andrey Nechet <ne...@hotmail.com> wrote:
>
> The problem in next - I work for test application for network game server.
> It's a huge traffic generator should be.
> The clients should be started and stopped any times for load measurements
> and so on....
> But the 3 new threads leaves running for each stopped process.
> >>Thread [AnonymousIoService-X-X] (Running)
> >>Thread [AnonymousIoService-X-X] (Running)
> >>Thread [PooledByteBufferExpirer-X] (Running)
>
> For one start/stop cycle it's acceptable, but then I need more cycles - that
> not so good...
> :)
>
>
> >From: sishen <si...@gmail.com>
> >Reply-To: mina-dev@directory.apache.org
> >To: mina-dev@directory.apache.org
> >Subject: Re: Close session ?
> >Date: Fri, 3 Nov 2006 17:19:31 +0800
> >
> >just go on executing...
> >
> >On 11/3/06, Andrey Nechet <ne...@hotmail.com> wrote:
> >>
> >>Hi,
> >>
> >>I would like to use Mina for simple client connection.
> >>Simplified code:
> >>                 IoConnector connector = new SocketConnector();
> >>                 SocketAddress socketAddress = new InetSocketAddress(
> >>config.getHost(),
> >>                                 config.getPort());
> >>                 try {
> >>                         ConnectFuture future = connector.connect
> >>(socketAddress,
> >>                                         new IoHandler(){....});
> >>
> >>                         future.join();
> >>                         IoSession session = future.getSession();
> >>                         session.close();
> >>                 } catch (IOException e) {
> >>                         e.printStackTrace();
> >>                 }
> >>
> >>Question:
> >>After future.join() I have the next additional Threads in debugger:
> >>Thread [AnonymousIoService-1-1] (Running)
> >>Thread [SocketIoProcessor-0] (Running)
> >>Thread [AnonymousIoService-1-2] (Running)
> >>Thread [PooledByteBufferExpirer-0] (Running)
> >>
> >>All seems OK. But after sesson.close() only one Thread
> >>[SocketIoProcessor-0]
> >>terminated.
> >>How I can terminate another threads?

They are all daemon threads, so they will exit together when the
process exits.  To be short, please ignore them.

HTH,
Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP key fingerprints:
* E167 E6AF E73A CBCE EE41  4A29 544D DE48 FE95 4E7E
* B693 628E 6047 4F8F CFA4  455E 1C62 A7DC 0255 ECA6

Re: Close session ?

Posted by Andrey Nechet <ne...@hotmail.com>.
The problem in next - I work for test application for network game server.
It's a huge traffic generator should be.
The clients should be started and stopped any times for load measurements 
and so on....
But the 3 new threads leaves running for each stopped process.
>>Thread [AnonymousIoService-X-X] (Running)
>>Thread [AnonymousIoService-X-X] (Running)
>>Thread [PooledByteBufferExpirer-X] (Running)

For one start/stop cycle it's acceptable, but then I need more cycles - that 
not so good...
:)


>From: sishen <si...@gmail.com>
>Reply-To: mina-dev@directory.apache.org
>To: mina-dev@directory.apache.org
>Subject: Re: Close session ?
>Date: Fri, 3 Nov 2006 17:19:31 +0800
>
>just go on executing...
>
>On 11/3/06, Andrey Nechet <ne...@hotmail.com> wrote:
>>
>>Hi,
>>
>>I would like to use Mina for simple client connection.
>>Simplified code:
>>                 IoConnector connector = new SocketConnector();
>>                 SocketAddress socketAddress = new InetSocketAddress(
>>config.getHost(),
>>                                 config.getPort());
>>                 try {
>>                         ConnectFuture future = connector.connect
>>(socketAddress,
>>                                         new IoHandler(){....});
>>
>>                         future.join();
>>                         IoSession session = future.getSession();
>>                         session.close();
>>                 } catch (IOException e) {
>>                         e.printStackTrace();
>>                 }
>>
>>Question:
>>After future.join() I have the next additional Threads in debugger:
>>Thread [AnonymousIoService-1-1] (Running)
>>Thread [SocketIoProcessor-0] (Running)
>>Thread [AnonymousIoService-1-2] (Running)
>>Thread [PooledByteBufferExpirer-0] (Running)
>>
>>All seems OK. But after sesson.close() only one Thread
>>[SocketIoProcessor-0]
>>terminated.
>>How I can terminate another threads?
>>
>>Regards,
>>Andrey
>>
>>_________________________________________________________________
>>Express yourself instantly with MSN Messenger! Download today it's FREE!
>>http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
>>
>>

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


Re: Close session ?

Posted by sishen <si...@gmail.com>.
just go on executing...

On 11/3/06, Andrey Nechet <ne...@hotmail.com> wrote:
>
> Hi,
>
> I would like to use Mina for simple client connection.
> Simplified code:
>                 IoConnector connector = new SocketConnector();
>                 SocketAddress socketAddress = new InetSocketAddress(
> config.getHost(),
>                                 config.getPort());
>                 try {
>                         ConnectFuture future = connector.connect
> (socketAddress,
>                                         new IoHandler(){....});
>
>                         future.join();
>                         IoSession session = future.getSession();
>                         session.close();
>                 } catch (IOException e) {
>                         e.printStackTrace();
>                 }
>
> Question:
> After future.join() I have the next additional Threads in debugger:
> Thread [AnonymousIoService-1-1] (Running)
> Thread [SocketIoProcessor-0] (Running)
> Thread [AnonymousIoService-1-2] (Running)
> Thread [PooledByteBufferExpirer-0] (Running)
>
> All seems OK. But after sesson.close() only one Thread
> [SocketIoProcessor-0]
> terminated.
> How I can terminate another threads?
>
> Regards,
> Andrey
>
> _________________________________________________________________
> Express yourself instantly with MSN Messenger! Download today it's FREE!
> http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
>
>