Search in sources :

Example 1 with FailureEventHandler

use of com.navercorp.pinpoint.rpc.FailureEventHandler in project pinpoint by naver.

the class RequestManager method register.

public ChannelWriteFailListenableFuture<ResponseMessage> register(RequestPacket requestPacket, long timeoutMillis) {
    // shutdown check
    final int requestId = getNextRequestId();
    requestPacket.setRequestId(requestId);
    final ChannelWriteFailListenableFuture<ResponseMessage> future = new ChannelWriteFailListenableFuture<ResponseMessage>(timeoutMillis);
    final DefaultFuture old = this.requestMap.put(requestId, future);
    if (old != null) {
        throw new PinpointSocketException("unexpected error. old future exist:" + old + " id:" + requestId);
    }
    // when future fails, put a handle in order to remove a failed future in the requestMap.
    FailureEventHandler removeTable = createFailureEventHandler(requestId);
    future.setFailureEventHandler(removeTable);
    addTimeoutTask(timeoutMillis, future);
    return future;
}
Also used : FailureEventHandler(com.navercorp.pinpoint.rpc.FailureEventHandler) PinpointSocketException(com.navercorp.pinpoint.rpc.PinpointSocketException) ResponseMessage(com.navercorp.pinpoint.rpc.ResponseMessage) ChannelWriteFailListenableFuture(com.navercorp.pinpoint.rpc.ChannelWriteFailListenableFuture) DefaultFuture(com.navercorp.pinpoint.rpc.DefaultFuture)

Aggregations

ChannelWriteFailListenableFuture (com.navercorp.pinpoint.rpc.ChannelWriteFailListenableFuture)1 DefaultFuture (com.navercorp.pinpoint.rpc.DefaultFuture)1 FailureEventHandler (com.navercorp.pinpoint.rpc.FailureEventHandler)1 PinpointSocketException (com.navercorp.pinpoint.rpc.PinpointSocketException)1 ResponseMessage (com.navercorp.pinpoint.rpc.ResponseMessage)1