@Override public UUID requestId() { return this.inReplyTo.requestId(); }
@Override public UUID requestId() { return delegate.requestId(); }
@Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { if (msg instanceof ClientResourceResponseImpl) { ResourceRequest inReplyTo = ((ClientResourceResponseImpl) msg).inReplyTo(); Consumer<ClientResourceResponse> handler = this.handlers.remove(inReplyTo.requestId()); if (handler != null) { this.executor.execute(() -> handler.accept((ClientResourceResponse) msg)); } } else { super.channelRead(ctx, msg); } }
@Override public void onInbound(InboundInterceptorContext context) throws Exception { UUID requestId = context.request().requestId(); this.timings.put(requestId, System.currentTimeMillis()); super.onInbound(context); }
private DefaultResourceRequest(ResourceRequest original) { this.requestType = original.requestType(); this.resourcePath = original.resourcePath(); this.requestId = original.requestId(); }
@Override public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { if (msg instanceof ClientRequest) { ResourceRequest request = ((ClientRequest) msg).resourceRequest(); Consumer<ClientResourceResponse> handler = ((ClientRequest) msg).handler(); this.handlers.put(request.requestId(), handler); super.write(ctx, request, promise); } else { super.write(ctx, msg, promise); } }
private void handleError(ChannelHandlerContext ctx, ResourceRequest inReplyTo, Throwable e) { ErrorHandler.handleError(ctx, inReplyTo, e); ctx.fireUserEventTriggered(new RequestCompleteEvent(inReplyTo.requestId())); } }