コード例 #1
0
ファイル: Server.java プロジェクト: Analect/neo4j
 protected void tryToFinishOffChannel(Channel channel) {
   Pair<RequestContext, AtomicLong> slave;
   slave = unmapSlave(channel);
   if (slave == null) {
     return;
   }
   tryToFinishOffChannel(channel, slave.first());
 }
コード例 #2
0
ファイル: Server.java プロジェクト: Analect/neo4j
  @Override
  public void channelDisconnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
    super.channelDisconnected(ctx, e);

    if (!ctx.getChannel().isConnected()) {
      tryToFinishOffChannel(ctx.getChannel());
    }
  }
コード例 #3
0
ファイル: Server.java プロジェクト: Analect/neo4j
  @Override
  public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
    super.channelClosed(ctx, e);

    if (!ctx.getChannel().isOpen()) {
      tryToFinishOffChannel(ctx.getChannel());
    }

    channelGroup.remove(e.getChannel());
  }
コード例 #4
0
ファイル: Server.java プロジェクト: Analect/neo4j
  @Override
  public void messageReceived(ChannelHandlerContext ctx, MessageEvent event) throws Exception {
    try {
      ChannelBuffer message = (ChannelBuffer) event.getMessage();
      handleRequest(message, event.getChannel());
    } catch (Throwable e) {
      msgLog.error("Error handling request", e);

      // Attempt to reply to the client
      ChunkingChannelBuffer buffer = newChunkingBuffer(event.getChannel());
      buffer.clear(/* failure = */ true);
      writeFailureResponse(e, buffer);

      ctx.getChannel().close();
      tryToFinishOffChannel(ctx.getChannel());
      throw Exceptions.launderedException(e);
    }
  }