use of com.linkedin.r2.util.finalizer.RequestFinalizerManager in project rest.li by linkedin.
the class TestClientRequestFinalizerFilter method registerRequestFinalizer.
private void registerRequestFinalizer() {
final RequestFinalizerManager manager = RequestContextUtil.getClientRequestFinalizerManager(_requestContext);
manager.registerRequestFinalizer(_testRequestFinalizer);
}
use of com.linkedin.r2.util.finalizer.RequestFinalizerManager in project rest.li by linkedin.
the class ClientRequestFinalizerFilter method handleRequest.
private <REQ extends Request, RES extends Response> void handleRequest(REQ request, RequestContext requestContext, Map<String, String> wireAttrs, NextFilter<REQ, RES> nextFilter) {
final RequestFinalizerManagerImpl manager = (RequestFinalizerManagerImpl) requestContext.getLocalAttr(R2Constants.CLIENT_REQUEST_FINALIZER_MANAGER_REQUEST_CONTEXT_KEY);
if (manager == null) {
requestContext.putLocalAttr(R2Constants.CLIENT_REQUEST_FINALIZER_MANAGER_REQUEST_CONTEXT_KEY, new RequestFinalizerManagerImpl(request, requestContext));
} else {
if (LOG.isDebugEnabled()) {
LOG.debug(String.format("A RequestFinalizerManager already exists in the RequestContext.\nRequest ID: %s\nRequest: %s\nRequestContext ID: %s" + "\nRequestContext: %s", System.identityHashCode(request), request, System.identityHashCode(requestContext), requestContext), new RuntimeException());
}
}
nextFilter.onRequest(request, requestContext, wireAttrs);
}
Aggregations