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 10:07:22 UTC

Session close....

Hi,
I would like to create a simple client connection.

Used 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 an additional Threads in debugger view:
Thread [AnonymousIoService-1-1] (Running)
Thread [SocketIoProcessor-0] (Running)
Thread [AnonymousIoService-1-2] (Running)
Thread [PooledByteBufferExpirer-0] (Running)

All seems OK. But after session.close() only [SocketIoProcessor-0] thread 
terminated.
How I can to 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: Session close....

Posted by Andrey Nechet <ne...@hotmail.com>.
Thanks for advice Niklas, seems it works :)

>
>The threads should die off eventually. But it would be better if you only 
>create one SocketConnector and reuse that each time you need to connect.
>
>/Niklas

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


Re: Session close....

Posted by Niklas Therning <ni...@trillian.se>.
Andrey Nechet wrote:
> Hi,
> I would like to create a simple client connection.
> 
> Used 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 an additional Threads in debugger view:
> Thread [AnonymousIoService-1-1] (Running)
> Thread [SocketIoProcessor-0] (Running)
> Thread [AnonymousIoService-1-2] (Running)
> Thread [PooledByteBufferExpirer-0] (Running)
> 
> All seems OK. But after session.close() only [SocketIoProcessor-0] 
> thread terminated.
> How I can to terminate another threads?

The threads should die off eventually. But it would be better if you 
only create one SocketConnector and reuse that each time you need to 
connect.

/Niklas