/** The req listener. */ /* * (non-Javadoc) * * @see * org.glassfish.jersey.server.monitoring.ApplicationEventListener#onRequest(org.glassfish.jersey.server.monitoring * .RequestEvent) */ @Override public RequestEventListener onRequest(RequestEvent requestEvent) { // Request start events are sent to application listener and not request listener if (RequestEvent.Type.START == requestEvent.getType()) { MetricsService metricsSvc = LensServices.get().getService(MetricsService.NAME); if (metricsSvc != null) { metricsSvc.incrCounter(LensRequestListener.class, LensRequestListener.HTTP_REQUESTS_STARTED); } } return new LensRequestListener(); }
@Override public RequestEventListener onRequest(RequestEvent event) { if (Timer.enabled()) { return new TimingRequestEventListener(nextReqId ++); } return null; }
private void execute() { this.listener.onEvent(this.appEvent); final RequestEventListener requestListener = this.listener .onRequest(this.requestStartEvent); requestListener.onEvent(this.requestMethodStartEvent); requestListener.onEvent(this.responseFiltersStartEvent); }
private void executeWithException() { this.listener.onEvent(this.appEvent); final RequestEventListener requestListener = this.listener .onRequest(this.requestStartEvent); requestListener.onEvent(this.requestMethodStartEvent); requestListener.onEvent(this.requestMethodExceptionEvent); }
@Test public void commitsAndClosesOnSuccessfulFinish() throws SQLException, NoSuchMethodException { prepareAppEvent("methodWithDefaultAnnotation"); listener.onEvent(appEvent); RequestEventListener requestListener = listener.onRequest(requestStartEvent); when(requestFinishEvent.isSuccess()).thenReturn(true); requestListener.onEvent(requestFinishEvent); verify(connection).commit(); verify(connection).close(); verify(connection, never()).rollback(); }
@Test public void doesNotCommitOrCloseOnUnsuccessfulFinish() throws SQLException, NoSuchMethodException { prepareAppEvent("methodWithDefaultAnnotation"); listener.onEvent(appEvent); RequestEventListener requestListener = listener.onRequest(requestStartEvent); when(requestFinishEvent.isSuccess()).thenReturn(false); requestListener.onEvent(requestFinishEvent); verify(connection, never()).commit(); verify(connection, never()).close(); }
@Test public void rollbackAndCloseOnException() throws SQLException, NoSuchMethodException { prepareAppEvent("methodWithDefaultAnnotation"); listener.onEvent(appEvent); RequestEventListener requestListener = listener.onRequest(requestStartEvent); requestListener.onEvent(requestMethodExceptionEvent); verify(connection).rollback(); verify(connection).close(); verify(connection, never()).commit(); }
private void execute() { listener.onEvent(appEvent); RequestEventListener requestListener = listener.onRequest(requestStartEvent); requestListener.onEvent(requestMethodStartEvent); requestListener.onEvent(responseFiltersStartEvent); requestListener.onEvent(responseFinishedEvent); }
private void executeWithException() { listener.onEvent(appEvent); RequestEventListener requestListener = listener.onRequest(requestStartEvent); requestListener.onEvent(requestMethodStartEvent); requestListener.onEvent(requestMethodExceptionEvent); requestListener.onEvent(responseFiltersStartEvent); requestListener.onEvent(responseFinishedEvent); }
@Test public void shouldReturnOpenSessionInViewFilterOnRequestEvent() { DatabaseConfiguration configuration = mock(DatabaseConfiguration.class); JerseyApplicationEventListener listener = new JerseyApplicationEventListener(configuration); RequestEvent requestEvent = mock(RequestEvent.class); RequestEventListener eventListener = listener.onRequest(requestEvent); assertTrue(eventListener instanceof OpenSessionInViewFilter); assertEquals(((OpenSessionInViewFilter)eventListener).getConfiguration(), configuration); }
@Override public RequestEventListener onRequest(RequestEvent requestEvent) { return new MetricsRequestEventListener(meterRegistry, tagsProvider, metricName, autoTimeRequests, annotationFinder); }
@Override public RequestEventListener onRequest(RequestEvent requestEvent) { return null; }
@Override public RequestEventListener onRequest(RequestEvent requestEvent) { return new APIxRequestEventListener(); }
@Override public synchronized RequestEventListener onRequest(RequestEvent requestEvent) { return null; }
@Override public RequestEventListener onRequest(RequestEvent requestEvent) { return new ExceptionRequestEventListener(); }
@Override public RequestEventListener onRequest(final RequestEvent event) { return new UnitOfWorkEventListener(this.methodMap, this.bundles); }
@Override public RequestEventListener onRequest(RequestEvent requestEvent) { return null; // no request processing }
@Override public RequestEventListener onRequest(RequestEvent requestEvent) { return new UnitOfWorkEventListener(methodMap, transactionManager, runWithTxnIfNotConfigured); }
@Override public RequestEventListener onRequest(RequestEvent requestEvent) { // Do nothing per request return null; }
@Override public RequestEventListener onRequest(RequestEvent requestEvent) { requestCounter++; LOG.info("Request " + requestCounter + " started."); return new LoggingRequestEventListener(requestCounter); }
@Override public RequestEventListener onRequest(RequestEvent event) { return new JooqTransactionalRequestListener(); }
@Override public RequestEventListener onRequest(RequestEvent event) { return new UnitOfWorkEventListener(methodMap, entityManagerFactories); }
@Override public RequestEventListener onRequest(final RequestEvent requestEvent) { return new CircuitBreakerEventListener(this, this.circuitBreaker, this.meterMap); }
@Override public RequestEventListener onRequest(RequestEvent requestEvent) { return new RestSkolRequestListener(); }
@Override public RequestEventListener onRequest(org.glassfish.jersey.server.monitoring.RequestEvent requestEvent) { AmebaFeature.publishEvent(new RequestEvent(requestEvent)); return event -> AmebaFeature.publishEvent(new RequestEvent(event)); }
@Override public RequestEventListener onRequest(final RequestEvent event) { return new MetricsRequestEventListener(methodMetrics, time); }
@Override public RequestEventListener onRequest(final RequestEvent requestEvent) { return this; }
@Override public RequestEventListener onRequest(RequestEvent requestEvent) { return new OpenSessionInViewFilter(configuration); }
@Override public RequestEventListener onRequest(RequestEvent event) { RequestEventListener listener = new UnitOfWorkEventListener(methodMap, sessionFactoryMap); return listener; }
private void execute() { listener.onEvent(appEvent); RequestEventListener requestListener = listener.onRequest(requestStartEvent); requestListener.onEvent(requestMethodStartEvent); requestListener.onEvent(responseFiltersStartEvent); }
private void executeWithException() { listener.onEvent(appEvent); RequestEventListener requestListener = listener.onRequest(requestStartEvent); requestListener.onEvent(requestMethodStartEvent); requestListener.onEvent(requestMethodExceptionEvent); }