예제 #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);
    }
  }