ChannelSink.eventSunk() doesn't catch OPEN state with TRUE as value

Rafael Marins rafael.marins at neociclo.com
Tue Aug 11 23:26:55 EDT 2009


Hi Trustin,

On Aug 11, 2009, at 11:59 PM, Trustin Lee (via Nabble) wrote:

> Hi Rafael,
>
> A Channel is supposed to be open when it is constructed.  If you  
> take a
> look into the source code of a Channel implementation, you will find
> that it triggers a channelOpen event in its constructor.  Therefore,
> there is no need to send OPEN(TRUE) downstream - it's open already and
> hence no need to request it.

I was also triggering the channelOpen event in my channel constructor,  
but doing so I could't get notified on the ChannelSink about the  
OPEN(TRUE). I would like to use the OPEN(TRUE) event on ChannelSink to  
initialize the hardware device.

To overcome that issue I'm invoking the sink.eventSunk() method from  
my channel constructor, just as below. Then, I handle the OPEN(TRUE)  
on ChannelSink to trigger the channelOpen event.

         ChannelFuture future = future(this);
         try {
             sink.eventSunk(pipeline, new  
DownstreamChannelStateEvent(this, future, OPEN, TRUE));
         } catch (Throwable t) {
             future.setFailure(t);
             fireExceptionCaught(this, t);
         }

It makes more sense, for me, since I had to initialize the hardware  
device (as said before) and caught the channelOpen event on an upper  
SimpleChannelHandler subclass to configure the ChannelConfig properly.  
The ChannelConfig is later used during channelConnect phase.

--
Rafael Marins


-----
Rafael Marins
Neociclo - http://www.neociclo.com


-- 
View this message in context: http://n2.nabble.com/ChannelSink.eventSunk%28%29-doesn%27t-catch-OPEN-state-with-TRUE-as-value-tp3427637p3428305.html
Sent from the Netty User Group mailing list archive at Nabble.com.


More information about the netty-users mailing list