/** * Tracing support - log invocation of interceptor BEFORE context.proceed() call. * * @param interceptor invoked interceptor * @param event event type to be tested */ protected final void traceBefore(final T interceptor, final TracingLogger.Event event) { if (tracingLogger.isLogEnabled(event)) { if ((lastTracedInterceptor != null) && (interceptor != null)) { tracingLogger.logDuration(event, lastTracedInterceptor.getTimestamp(), lastTracedInterceptor.getInterceptor()); } lastTracedInterceptor = new InterceptorTimestampPair<T>(interceptor, System.nanoTime()); } }
/** * Tracing support - log invocation of interceptor AFTER context.proceed() call. * * @param interceptor invoked interceptor * @param event event type to be tested */ protected final void traceAfter(final T interceptor, final TracingLogger.Event event) { if (tracingLogger.isLogEnabled(event)) { if ((lastTracedInterceptor != null) && (lastTracedInterceptor.getInterceptor() != null)) { tracingLogger.logDuration(event, lastTracedInterceptor.getTimestamp(), interceptor); } lastTracedInterceptor = new InterceptorTimestampPair<T>(interceptor, System.nanoTime()); } }
/** * Tracing support - log invocation of interceptor BEFORE context.proceed() call. * * @param interceptor invoked interceptor * @param event event type to be tested */ protected final void traceBefore(final T interceptor, final TracingLogger.Event event) { if (tracingLogger.isLogEnabled(event)) { if ((lastTracedInterceptor != null) && (interceptor != null)) { tracingLogger.logDuration(event, lastTracedInterceptor.getTimestamp(), lastTracedInterceptor.getInterceptor()); } lastTracedInterceptor = new InterceptorTimestampPair<T>(interceptor, System.nanoTime()); } }
/** * Tracing support - log invocation of interceptor AFTER context.proceed() call. * * @param interceptor invoked interceptor * @param event event type to be tested */ protected final void traceAfter(final T interceptor, final TracingLogger.Event event) { if (tracingLogger.isLogEnabled(event)) { if ((lastTracedInterceptor != null) && (lastTracedInterceptor.getInterceptor() != null)) { tracingLogger.logDuration(event, lastTracedInterceptor.getTimestamp(), interceptor); } lastTracedInterceptor = new InterceptorTimestampPair<T>(interceptor, System.nanoTime()); } }
throw new ProcessingException(t); } finally { tracingLogger.logDuration(ServerTraceEvent.METHOD_INVOKE, timestamp, resource, method);
throw new ProcessingException(t); } finally { tracingLogger.logDuration(ServerTraceEvent.METHOD_INVOKE, timestamp, resource, method);
} finally { processedCount++; tracingLogger.logDuration(ServerTraceEvent.RESPONSE_FILTER, filterTimestamp, filter); tracingLogger.logDuration(ServerTraceEvent.RESPONSE_FILTER_SUMMARY, timestamp, processedCount);
} finally { processedCount++; tracingLogger.logDuration(ServerTraceEvent.RESPONSE_FILTER, filterTimestamp, filter); tracingLogger.logDuration(ServerTraceEvent.RESPONSE_FILTER_SUMMARY, timestamp, processedCount);
executor.proceed(); } finally { tracingLogger.logDuration(MsgTraceEvent.WI_SUMMARY, timestamp, executor.getProcessedCount());
executor.proceed(); } finally { tracingLogger.logDuration(MsgTraceEvent.WI_SUMMARY, timestamp, executor.getProcessedCount());
tracingLogger.logDuration(MsgTraceEvent.RI_SUMMARY, timestamp, executor.getProcessedCount());
tracingLogger.logDuration(MsgTraceEvent.RI_SUMMARY, timestamp, executor.getProcessedCount());
@SuppressWarnings("unchecked") private void invokeWriteTo(final WriterInterceptorContext context, final MessageBodyWriter writer) throws WebApplicationException, IOException { final TracingLogger tracingLogger = getTracingLogger(); final long timestamp = tracingLogger.timestamp(MsgTraceEvent.MBW_WRITE_TO); final UnCloseableOutputStream entityStream = new UnCloseableOutputStream(context.getOutputStream(), writer); try { writer.writeTo(context.getEntity(), context.getType(), context.getGenericType(), context.getAnnotations(), context.getMediaType(), context.getHeaders(), entityStream); } finally { tracingLogger.logDuration(MsgTraceEvent.MBW_WRITE_TO, timestamp, writer); } } }
@SuppressWarnings("unchecked") private void invokeWriteTo(final WriterInterceptorContext context, final MessageBodyWriter writer) throws WebApplicationException, IOException { final TracingLogger tracingLogger = getTracingLogger(); final long timestamp = tracingLogger.timestamp(MsgTraceEvent.MBW_WRITE_TO); final UnCloseableOutputStream entityStream = new UnCloseableOutputStream(context.getOutputStream(), writer); try { writer.writeTo(context.getEntity(), context.getType(), context.getGenericType(), context.getAnnotations(), context.getMediaType(), context.getHeaders(), entityStream); } finally { tracingLogger.logDuration(MsgTraceEvent.MBW_WRITE_TO, timestamp, writer); } } }
} finally { processedCount++; tracingLogger.logDuration(filterEvent, filterTimestamp, filter); context.triggerEvent(RequestEvent.Type.REQUEST_FILTERED); tracingLogger.logDuration(summaryEvent, timestamp, processedCount);
} finally { processedCount++; tracingLogger.logDuration(filterEvent, filterTimestamp, filter); context.triggerEvent(RequestEvent.Type.REQUEST_FILTERED); tracingLogger.logDuration(summaryEvent, timestamp, processedCount);
@SuppressWarnings("unchecked") private Object invokeReadFrom(final ReaderInterceptorContext context, final MessageBodyReader reader, final EntityInputStream input) throws WebApplicationException, IOException { final TracingLogger tracingLogger = getTracingLogger(); final long timestamp = tracingLogger.timestamp(MsgTraceEvent.MBR_READ_FROM); final InputStream stream = new UnCloseableInputStream(input, reader); try { return reader.readFrom(context.getType(), context.getGenericType(), context.getAnnotations(), context.getMediaType(), context.getHeaders(), stream); } catch (final NoContentException ex) { if (translateNce) { throw new BadRequestException(ex); } else { throw ex; } } finally { tracingLogger.logDuration(MsgTraceEvent.MBR_READ_FROM, timestamp, reader); } } }
@SuppressWarnings("unchecked") private Object invokeReadFrom(final ReaderInterceptorContext context, final MessageBodyReader reader, final EntityInputStream input) throws WebApplicationException, IOException { final TracingLogger tracingLogger = getTracingLogger(); final long timestamp = tracingLogger.timestamp(MsgTraceEvent.MBR_READ_FROM); final InputStream stream = new UnCloseableInputStream(input, reader); try { return reader.readFrom(context.getType(), context.getGenericType(), context.getAnnotations(), context.getMediaType(), context.getHeaders(), stream); } catch (final NoContentException ex) { if (translateNce) { throw new BadRequestException(ex); } else { throw ex; } } finally { tracingLogger.logDuration(MsgTraceEvent.MBR_READ_FROM, timestamp, reader); } } }
/** * {@inheritDoc} * <p/> * Routing stage navigates through the nested {@link Router routing hierarchy} * using a depth-first transformation strategy until a request-to-response * inflector is {@link org.glassfish.jersey.process.internal.Inflecting found on * a leaf stage node}, in which case the request routing is terminated and an * {@link org.glassfish.jersey.process.Inflector inflector} (if found) is pushed * to the {@link RoutingContext routing context}. */ @Override public Continuation<RequestProcessingContext> apply(final RequestProcessingContext context) { final ContainerRequest request = context.request(); context.triggerEvent(RequestEvent.Type.MATCHING_START); final TracingLogger tracingLogger = TracingLogger.getInstance(request); final long timestamp = tracingLogger.timestamp(ServerTraceEvent.MATCH_SUMMARY); try { final RoutingResult result = _apply(context, routingRoot); Stage<RequestProcessingContext> nextStage = null; if (result.endpoint != null) { context.routingContext().setEndpoint(result.endpoint); nextStage = getDefaultNext(); } return Continuation.of(result.context, nextStage); } finally { tracingLogger.logDuration(ServerTraceEvent.MATCH_SUMMARY, timestamp); } }
/** * {@inheritDoc} * <p/> * Routing stage navigates through the nested {@link Router routing hierarchy} * using a depth-first transformation strategy until a request-to-response * inflector is {@link org.glassfish.jersey.process.internal.Inflecting found on * a leaf stage node}, in which case the request routing is terminated and an * {@link org.glassfish.jersey.process.Inflector inflector} (if found) is pushed * to the {@link RoutingContext routing context}. */ @Override public Continuation<RequestProcessingContext> apply(final RequestProcessingContext context) { final ContainerRequest request = context.request(); context.triggerEvent(RequestEvent.Type.MATCHING_START); final TracingLogger tracingLogger = TracingLogger.getInstance(request); final long timestamp = tracingLogger.timestamp(ServerTraceEvent.MATCH_SUMMARY); try { final RoutingResult result = _apply(context, routingRoot); Stage<RequestProcessingContext> nextStage = null; if (result.endpoint != null) { context.routingContext().setEndpoint(result.endpoint); nextStage = getDefaultNext(); } return Continuation.of(result.context, nextStage); } finally { tracingLogger.logDuration(ServerTraceEvent.MATCH_SUMMARY, timestamp); } }