dev@grizzly.java.net

Re: What are purposes to define PAUSE in com.sun.grizzly.Transport.java in Grizzly 2.0?

From: Oleksiy Stashok <Oleksiy.Stashok_at_Sun.COM>
Date: Wed, 24 Jun 2009 11:25:58 +0200

Hi Ming Qin,

when Transport is in PAUSE state - it stops to process I/O Events,
which occur on Connection(s). At the same time existing Connections
are not get closed, so after doing "resume", Transport will continue
its normal execution.
PAUSE, as I see, could be used for some monitoring/debuging reasons.
When you have server, which consists of several Transports, you may
want to start/stop or pause/resume one of them to localize issues like
DoS attacks etc.

Hope this will help.

WBR,
Alexey.

On Jun 24, 2009, at 2:44 , ming qin wrote:

> Hi:
> Transport.java has ENUM type State. One of constants of State is
> PAUSE. com.sun.grizzly.utils.StateHolder .java broadcasts
> Transport.State status to registered Listensers- such as
> CoutDownLatch, Callable, Locker Object , Future etc.
>
>
> With PAUSE as one of constants in Transport, TCPNIOTransport.java
> has an implementation on pause() method which updates its
> StateHolder’s state to PAUSE. In an separated thread fired by
> SelectorRunner.java’s run( ), the while loop needs to validate
> Transport’s status against State.PAUSE .
>
>
> Since TCPNIOTransport’s implementing pause method, programmers could
> introduce below codes which cause
> java.util.concurrent.TimeoutException or java.io.IOException:
> Channel registration on Selector Timeout!
>
> transport.start()
> .....
> ......
> transport.pose() //set transport to pose STATE method before
> connection is created
> ….
> …..
> connection.XXX()
>
> ….
> transport.pose() // set transport to pose STATE , during I/O event
> ….
> connection.XXX()
> ….
> …
>
> connection.close()
> transport.stop()
>
> All of above bring me the question : do we really need PAUSE as
> state status for Transport abstraction in Grizzly 2.0?
>
> Ming Qin
> Cell Phone 858-353-2839