use of com.navercorp.pinpoint.rpc.ChannelWriteFailListenableFuture 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;
}
Aggregations