users@grizzly.java.net

Grizzly 2.0 .unbind() , threads and filter chain

From: kermitas <kermitas_at_tlen.pl>
Date: Tue, 12 May 2009 15:58:32 +0200

Hello Grizzly community :):),

I am starting to using Grizzly 2.0 and I have few questions.

First, I see TCPNIOTransport.bind ... but where is .unbind() ? Do I really have to do transport.close every time I want to unbind ? In that case what about my other connections and binding ? :(

Or maybe for every new binding I should get new transport TransportFactory.getInstance.createTCPTransport ?? Does every new TcpNioTransport needs at least one thread for Selector ?

I also see that whole transport has its own filter chain, but what about connections ? Why we can not have personalized filter chains for every connection ? (for example one connection can be a streaming, other can be messages based).

What I do is to use as low threads for Grizzly as it can be because sending out every event to Scala Actors world and process it there. I am using tcpNioTransport.setStrategy( new SameThreadStrategy ) and tcpNioTransport.setWorkerThreadPool( Executors.newSingleThreadExecutor ) ... but can I use this one executor (Executors.newSingleThreadExecutor) to all TcpNioTransports if I have to create new TcpNioTransport for every local binding ???

I want to hear what is best practice :
- how to open many local bindings and many connections
- always have a possibility to unbind local port and
- keep whole Grizzly use only one thread (just one is required for Selector)

Thank you for your help and time,
Arthur.