@Override public void onEvent(final ApplicationEvent event) { final ApplicationEvent.Type type = event.getType(); switch (type) { case RELOAD_FINISHED: case INITIALIZATION_FINISHED: processApplicationStatistics(event); break; } }
private ApplicationEvent getApplicationEvent(ApplicationEvent.Type type) { return new ApplicationEventImpl(type, initFinishedEvent.getResourceConfig(), initFinishedEvent.getProviders(), initFinishedEvent.getRegisteredClasses(), initFinishedEvent.getRegisteredInstances(), initFinishedEvent.getResourceModel()); }
@Override public void onEvent(ApplicationEvent event) { if (event.getType() == ApplicationEvent.Type.INITIALIZATION_APP_FINISHED) { resources = event.getResourceModel().getResources(); providers = event.getProviders(); final String resourceClasses = resources.stream() .map(x -> x.getClass().getCanonicalName()) .collect(Collectors.joining(", ")); final String providerClasses = providers.stream() .map(Class::getCanonicalName) .collect(Collectors.joining(", ")); LOGGER.debug("resources = {}", resourceClasses); LOGGER.debug("providers = {}", providerClasses); LOGGER.info(getEndpointsInfo()); } }
@Override public void onEvent(ApplicationEvent event) { if (event.getType() == ApplicationEvent.Type.INITIALIZATION_APP_FINISHED) { registerMetricsForModel(event.getResourceModel()); } }
@Provider public class ProviderLoggingListener implements ApplicationEventListener { @Override public void onEvent(ApplicationEvent event) { switch (event.getType()) { case INITIALIZATION_FINISHED: { Set<Class<?>> providers = event.getProviders(); ResourceConfig immutableConfig = event.getResourceConfig(); ResourceModel resourcesModel = event.getResourceModel(); break; } } } @Override public RequestEventListener onRequest(RequestEvent requestEvent) { return null; } }
@Override public void onEvent(ApplicationEvent applicationEvent) { if (parameterMap == null && applicationEvent.getType() == ApplicationEvent.Type.INITIALIZATION_START) { Set<Class<?>> providers = applicationEvent.getProviders(); ClassLoader classLoader = applicationEvent.getResourceConfig().getClassLoader(); parameterMap = buildParameterMap(providers, classLoader); } }
@Override public void onEvent(ApplicationEvent event) { switch (event.getType()) { case INITIALIZATION_FINISHED: log.info("Application {} was initialized.", event.getResourceConfig().getApplicationName()); break; case DESTROY_FINISHED: log.info("Application {} was destroyed", event.getResourceConfig().getApplicationName()); break; default: break; } } }
/** * <p>getResourceModel.</p> * * @return a {@link org.glassfish.jersey.server.model.ResourceModel} object. */ public ResourceModel getResourceModel() { return event.getResourceModel(); }
/** * <p>getProviders.</p> * * @return a {@link java.util.Set} object. */ public Set<Class<?>> getProviders() { return event.getProviders(); }
/** * <p>getResourceConfig.</p> * * @return a {@link org.glassfish.jersey.server.ResourceConfig} object. */ public ResourceConfig getResourceConfig() { return event.getResourceConfig(); }
/** * <p>getRegisteredClasses.</p> * * @return a {@link java.util.Set} object. */ public Set<Class<?>> getRegisteredClasses() { return event.getRegisteredClasses(); } }
/** * <p>getRegisteredInstances.</p> * * @return a {@link java.util.Set} object. */ public Set<Object> getRegisteredInstances() { return event.getRegisteredInstances(); }
@Override public void onEvent(final ApplicationEvent event) { if (event.getType() == ApplicationEvent.Type.INITIALIZATION_APP_FINISHED) { event.getResourceModel().getResources().parallelStream() .filter(Objects::nonNull) .forEach(resource -> { this.registerCircuitBreakerAnnotations(resource.getAllMethods()); resource.getChildResources().parallelStream() .filter(Objects::nonNull) .forEach(childResource -> { this.registerCircuitBreakerAnnotations( childResource.getAllMethods()); }); }); } }
private ApplicationEvent getApplicationEvent(ApplicationEvent.Type type) { return new ApplicationEventImpl(type, initFinishedEvent.getResourceConfig(), initFinishedEvent.getProviders(), initFinishedEvent.getRegisteredClasses(), initFinishedEvent.getRegisteredInstances(), initFinishedEvent.getResourceModel()); }
@Override public void onEvent(final ApplicationEvent event) { final ApplicationEvent.Type type = event.getType(); switch (type) { case RELOAD_FINISHED: case INITIALIZATION_FINISHED: processApplicationStatistics(event); break; } }
public void onEvent(ApplicationEvent event) { if (event.getType() == ApplicationEvent.Type.INITIALIZATION_APP_FINISHED) { for (Resource resource : event.getResourceModel().getResources()) { for (ResourceMethod method : resource.getAllMethods()) { registerUnitOfWorkWithDetachAnnotations(method); } for (Resource childResource : resource.getChildResources()) { for (ResourceMethod method : childResource.getAllMethods()) { registerUnitOfWorkWithDetachAnnotations(method); } } } } }
private void processApplicationStatistics(ApplicationEvent event) { final long now = System.currentTimeMillis(); final ApplicationInfo applicationInfo = new ApplicationInfoImpl(event.getResourceConfig(), new Date(now), event.getRegisteredClasses(), event.getRegisteredInstances(), event.getProviders()); applicationInfoRefProvider.get().set(applicationInfo); }
@Override public void onEvent(final ApplicationEvent event) { final ApplicationEvent.Type type = event.getType(); switch (type) { case INITIALIZATION_START:
public void onEvent(ApplicationEvent event) { if (event.getType() == ApplicationEvent.Type.INITIALIZATION_APP_FINISHED) { for (Resource resource : event.getResourceModel().getResources()) { for (ResourceMethod method : resource.getAllMethods()) { registerAuditedMethodAnnotations(method); } for (Resource childResource : resource.getChildResources()) { for (ResourceMethod method : childResource.getAllMethods()) { registerAuditedMethodAnnotations(method); } } } } }
private void processApplicationStatistics(ApplicationEvent event) { final long now = System.currentTimeMillis(); final ApplicationInfo applicationInfo = new ApplicationInfoImpl(event.getResourceConfig(), new Date(now), event.getRegisteredClasses(), event.getRegisteredInstances(), event.getProviders()); applicationInfoRefProvider.get().set(applicationInfo); }