예제 #1
0
 public TransportRequestHandler(
     Channel channel, TransportClient reverseClient, RpcHandler rpcHandler) {
   this.channel = channel;
   this.reverseClient = reverseClient;
   this.rpcHandler = rpcHandler;
   this.streamManager = rpcHandler.getStreamManager();
 }
예제 #2
0
 @Override
 public void channelUnregistered() {
   if (streamManager != null) {
     try {
       streamManager.connectionTerminated(channel);
     } catch (RuntimeException e) {
       logger.error("StreamManager connectionTerminated() callback failed.", e);
     }
   }
   rpcHandler.connectionTerminated(reverseClient);
 }
예제 #3
0
  private void processRpcRequest(final RpcRequest req) {
    try {
      rpcHandler.receive(
          reverseClient,
          req.message,
          new RpcResponseCallback() {
            @Override
            public void onSuccess(byte[] response) {
              respond(new RpcResponse(req.requestId, response));
            }

            @Override
            public void onFailure(Throwable e) {
              respond(new RpcFailure(req.requestId, Throwables.getStackTraceAsString(e)));
            }
          });
    } catch (Exception e) {
      logger.error("Error while invoking RpcHandler#receive() on RPC id " + req.requestId, e);
      respond(new RpcFailure(req.requestId, Throwables.getStackTraceAsString(e)));
    }
  }
예제 #4
0
 @Override
 public void exceptionCaught(Throwable cause) {
   rpcHandler.exceptionCaught(cause, reverseClient);
 }