use of com.navercorp.pinpoint.plugin.jetty.JettyAsyncListener in project pinpoint by naver.
the class RequestStartAsyncInterceptor method after.
@Override
public void after(Object target, Object[] args, Object result, Throwable throwable) {
if (isDebug) {
logger.afterInterceptor(target, args, result, throwable);
}
final Trace trace = traceContext.currentTraceObject();
if (trace == null) {
return;
}
try {
final SpanEventRecorder recorder = trace.currentSpanEventRecorder();
if (validate(target, result, throwable)) {
// Add async listener. Servlet 3.0
final AsyncContext asyncContext = (AsyncContext) result;
final AsyncListener asyncListener = new JettyAsyncListener(this.traceContext, recorder.recordNextAsyncContext(true));
asyncContext.addListener(asyncListener);
if (isDebug) {
logger.debug("Add async listener {}", asyncListener);
}
}
recorder.recordServiceType(JettyConstants.JETTY_METHOD);
recorder.recordApi(descriptor);
recorder.recordException(throwable);
} catch (Throwable t) {
logger.warn("Failed to AFTER process. {}", t.getMessage(), t);
} finally {
trace.traceBlockEnd();
}
}
Aggregations