Netty3 源码分析 - ChannelState

本文详细解析了 Netty3 中 ChannelState 的概念及其作用。通过一张表格展示了不同方向和状态下的 ChannelStateEvent 的含义,包括 OPEN、BOUND、CONNECTED 和 INTEREST_OPS 等状态,并解释了它们在上下游之间的变化。
Netty3 源码分析 - ChannelState


枚举类ChannelState代表的是这个Channel的状态集,状态的解读和ChannelStateEvent中的value值以及事件的方向息息相关,下面这个表可以从宏观上把握。

Direction

State

Value

Meaning

Upstream

OPEN

true

The channel is open.

Upstream

OPEN

false

The channel is closed.

Upstream

BOUND

SocketAddress

The channel is bound to a local address.

Upstream

BOUND

null

The channel is unbound to a local address.

Upstream

CONNECTED

SocketAddress

The channel is connected to a remote address.

Upstream

CONNECTED

null

The channel is disconnected from a remote address.

Upstream

INTEREST_OPS

an integer

The channel interestOps has been changed.

Downstream

OPEN

true

N/A(因为通道创建的时候就打开了)

Downstream

OPEN

false

Close the channel.

Downstream

BOUND

SocketAddress

Bind the channel to the specified local address.

Downstream

BOUND

null

Unbind the channel from the current local address.

Downstream

CONNECTED

SocketAddress

Connect the channel to the specified remote address.

Downstream

CONNECTED

null

Disconnect the channel from the current remote address.

Downstream

INTEREST_OPS

an integer

Change the interestOps of the channel.



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值