|
|||||||||
| 上一个类 下一个类 | 框架 无框架 | ||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | ||||||||
java.lang.Objectorg.jboss.netty.channel.SimpleChannelUpstreamHandler
public class SimpleChannelUpstreamHandler

为每个事件类型提供单独处理方法的ChannelUpstreamHandler
.处理器会把接收到的上游事件转型为更有意义的子类型事件并调用转型事件的适当方法.方法的名称与上游事件的名称一样.正如
ChannelEvent 文档所介绍.
如果你需要同时实现ChannelUpstreamHandler和ChannelDownstreamHandler,请使用
SimpleChannelHandler
handleUpstream方法
你可以像重写一般Java方法一样重写
handleUpstream
方法. 请确保调用super.handleUpstream()以便其他处理器的方法可以被正确的调用:
public class MyChannelHandler extendsSimpleChannelUpstreamHandler{@Overridepublic void handleUpstream(ChannelHandlerContextctx,ChannelEvente) throws Exception { // 记录所有通道状态改变. if (e instanceofChannelStateEvent) { logger.info("Channel state changed: " + e); } super.handleUpstream(ctx, e); } }
| 嵌套类摘要 |
|---|
| 从接口 org.jboss.netty.channel.ChannelHandler 继承的嵌套类/接口 |
|---|
ChannelHandler.Sharable |
| 构造方法摘要 | |
|---|---|
SimpleChannelUpstreamHandler()
创建一个实例. |
|
| 从类 java.lang.Object 继承的方法 |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 构造方法详细信息 |
|---|
public SimpleChannelUpstreamHandler()
| 方法详细信息 |
|---|
public void handleUpstream(ChannelHandlerContext ctx,
ChannelEvent e)
throws java.lang.Exception
ChannelUpstreamHandler 中的 handleUpstreamctx - 处理器的上下文对象e - 要处理或拦截的事件
java.lang.Exception
public void messageReceived(ChannelHandlerContext ctx,
MessageEvent e)
throws java.lang.Exception
ChannelBuffer)被接收时调用.
java.lang.Exception
public void exceptionCaught(ChannelHandlerContext ctx,
ExceptionEvent e)
throws java.lang.Exception
ChannelHandler抛出异常时被调用.
java.lang.Exception
public void channelOpen(ChannelHandlerContext ctx,
ChannelStateEvent e)
throws java.lang.Exception
Channel打开,但还没有绑定和连接时被调用.
java.lang.Exception
public void channelBound(ChannelHandlerContext ctx,
ChannelStateEvent e)
throws java.lang.Exception
Channel打开并且绑定到本地地址,但还没有连接时被调用.
java.lang.Exception
public void channelConnected(ChannelHandlerContext ctx,
ChannelStateEvent e)
throws java.lang.Exception
Channel打开并且绑定到本地地址和已连接到远程地址时被调用.
java.lang.Exception
public void channelInterestChanged(ChannelHandlerContext ctx,
ChannelStateEvent e)
throws java.lang.Exception
Channel的interestOps发送改变时调用.
java.lang.Exception
public void channelDisconnected(ChannelHandlerContext ctx,
ChannelStateEvent e)
throws java.lang.Exception
Channel被远程端断开连接时调用.
java.lang.Exception
public void channelUnbound(ChannelHandlerContext ctx,
ChannelStateEvent e)
throws java.lang.Exception
Channel被本地地址取消绑定时调用.
java.lang.Exception
public void channelClosed(ChannelHandlerContext ctx,
ChannelStateEvent e)
throws java.lang.Exception
Channel被关闭且它所有关联的资源被释放时调用.
java.lang.Exception
public void writeComplete(ChannelHandlerContext ctx,
WriteCompletionEvent e)
throws java.lang.Exception
Channel时调用.
java.lang.Exception
public void childChannelOpen(ChannelHandlerContext ctx,
ChildChannelStateEvent e)
throws java.lang.Exception
Channel打开时调用.(如.一个服务端通道接受一个连接)
java.lang.Exception
public void childChannelClosed(ChannelHandlerContext ctx,
ChildChannelStateEvent e)
throws java.lang.Exception
Channel被关闭时调用.(如.接收的连接被关闭)
java.lang.Exception
|
|||||||||
| 上一个类 下一个类 | 框架 无框架 | ||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | ||||||||