ChannelSink.eventSunk() doesn't catch OPEN state with TRUE as value
"이희승 (Trustin Lee)"
trustin at gmail.com
Wed Aug 12 00:10:38 EDT 2009
On 08/12/2009 12:26 PM, Rafael Marins wrote:
>
> 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.
Forgot to reply to the paragraph above.
It's because Channel.fireChannelOpen() triggers an upstream event. You
can trigger a downstream event using ChannelPipeline.sendDownstream().
However, most handler implementations will discard OPEN(TRUE) request
because it does not make sense to send an OPEN(TRUE) request from an
open channel (it's open already).
Therefore, I would recommend you to call the initialization method of
your ChannelSink implementation directly in the channel constructor.
HTH,
Trustin
More information about the netty-users
mailing list