コード例 #1
0
 /*
  * (non-Javadoc)
  * @see org.jboss.netty.channel.SimpleChannelUpstreamHandler#channelDisconnected(org.jboss.netty.channel.ChannelHandlerContext, org.jboss.netty.channel.ChannelStateEvent)
  */
 @Override
 public void channelDisconnected(ChannelHandlerContext ctx, ChannelStateEvent evt)
     throws Exception {
   MudSession session = (MudSession) ctx.getAttachment();
   TaskQueue.enqueue(new SessionCloseTask(session));
 }
コード例 #2
0
 /*
  * (non-Javadoc)
  * @see org.jboss.netty.channel.SimpleChannelUpstreamHandler#messageReceived(org.jboss.netty.channel.ChannelHandlerContext, org.jboss.netty.channel.MessageEvent)
  */
 @Override
 public void messageReceived(ChannelHandlerContext ctx, MessageEvent evt) throws Exception {
   MudSession session = (MudSession) ctx.getAttachment();
   String message = (String) evt.getMessage();
   TaskQueue.enqueue(new SessionMessageTask(session, message));
 }
コード例 #3
0
 /*
  * (non-Javadoc)
  * @see org.jboss.netty.channel.SimpleChannelUpstreamHandler#channelConnected(org.jboss.netty.channel.ChannelHandlerContext, org.jboss.netty.channel.ChannelStateEvent)
  */
 @Override
 public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent evt) throws Exception {
   MudSession session = new MudSession(ctx.getChannel());
   ctx.setAttachment(session);
   TaskQueue.enqueue(new SessionOpenTask(session));
 }