javax.enterprise.inject.spi.BeforeShutdown Java Examples

The following examples show how to use javax.enterprise.inject.spi.BeforeShutdown. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BeanManagerProvider.java    From deltaspike with Apache License 2.0 6 votes vote down vote up
/**
 * Cleanup on container shutdown.
 *
 * @param beforeShutdown CDI shutdown event
 */
public void cleanupStoredBeanManagerOnShutdown(@Observes BeforeShutdown beforeShutdown)
{
    // CDI#current delegation enabled, skip everything
    if (CDI_CURRENT_METHOD != null && CDI_CURRENT_BEAN_MANAGER_METHOD != null)
    {
        return;
    }

    if (bmpSingleton == null)
    {
        // this happens if there has been a failure at startup
        return;
    }

    bmpSingleton.bmInfos.remove(ClassUtils.getClassLoader(null));
}
 
Example #2
Source File: ActivitiExtension.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
public void beforeShutdown(@Observes BeforeShutdown event) {
  if (processEngineLookup != null) {
    processEngineLookup.ungetProcessEngine();
    processEngineLookup = null;
  }
  logger.info("Shutting down activiti-cdi");
}
 
Example #3
Source File: HealthExtension.java    From thorntail with Apache License 2.0 5 votes vote down vote up
/**
 * Called when the deployment is undeployed.
 *
 * Remove the reporter instance of {@link SmallRyeHealthReporter} from the {@link Monitor}.
 * Handle manually their CDI destroy lifecycle.
 */
public void beforeShutdown(@Observes final BeforeShutdown bs) {
    monitor.unregisterHealthReporter();
    monitor.unregisterContextClassLoader();
    reporter = null;
    reporterInstance.preDestroy().dispose();
    reporterInstance = null;
}
 
Example #4
Source File: RouteExtension.java    From weld-vertx with Apache License 2.0 5 votes vote down vote up
void beforeShutdown(@Observes BeforeShutdown event) {
    for (HandlerInstance<?> handler : handlerInstances) {
        handler.dispose();
    }
    handlerInstances.clear();
    handlerTypes.clear();
    routeObservers.clear();
}
 
Example #5
Source File: FlowableExtension.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
public void beforeShutdown(@Observes BeforeShutdown event) {
    if (processEngineLookup != null) {
        processEngineLookup.ungetProcessEngine();
        processEngineLookup = null;
    }
    LOGGER.info("Shutting down flowable-cdi");
}
 
Example #6
Source File: JAXWSCdiExtension.java    From openwebbeans-meecrowave with Apache License 2.0 5 votes vote down vote up
public void release(@Observes final BeforeShutdown beforeShutdown) {
    preShutdownTasks.stream().map(r -> (Runnable) () -> {
        try {
            r.run();
        } catch (final RuntimeException re) {
            new LogFacade(org.apache.meecrowave.cxf.JAXWSCdiExtension.class.getName()).warn(re.getMessage(), re);
        }
    }).forEach(Runnable::run);
    preShutdownTasks.clear();
}
 
Example #7
Source File: ExtraJCacheExtension.java    From jcache-cdi with Apache License 2.0 5 votes vote down vote up
public void destroyIfCreated(final @Observes BeforeShutdown beforeShutdown)
{
    if (cacheManager != null)
    {
        cacheManager.close();
    }
    if (cachingProvider != null)
    {
        cachingProvider.close();
    }
}
 
Example #8
Source File: JAXRSCdiResourceExtension.java    From cxf with Apache License 2.0 5 votes vote down vote up
/**
 * Releases created CreationalContext instances
 */
public void release(@Observes final BeforeShutdown event) {
    synchronized (disposableCreationalContexts) {
        for (final CreationalContext<?> disposableCreationalContext: disposableCreationalContexts) {
            disposableCreationalContext.release();
        }
        disposableCreationalContexts.clear();
    }

    disposableLifecycles.forEach(Lifecycle::destroy);
    disposableLifecycles.clear();
}
 
Example #9
Source File: HessianExtension.java    From tomee with Apache License 2.0 5 votes vote down vote up
protected void shutdown(final @Observes BeforeShutdown unused) {
    final HessianService service = SystemInstance.get().getComponent(HessianService.class);
    if (service == null) {
        return;
    }

    final HessianRegistry registry = service.getRegistry();
    for (final DeployedEndpoint pair : deployed) {
        registry.undeploy(service.getVirtualHost(), pair.app, pair.name);
        LOGGER.info("Undeployed CDI hessian service " + pair.name);
    }
    deployed.clear();
}
 
Example #10
Source File: ExtraJCacheExtension.java    From commons-jcs with Apache License 2.0 5 votes vote down vote up
public void destroyIfCreated(final @Observes BeforeShutdown beforeShutdown)
{
    if (cacheManager != null)
    {
        cacheManager.close();
    }
    if (cachingProvider != null)
    {
        cachingProvider.close();
    }
}
 
Example #11
Source File: BatchCDIInjectionExtension.java    From incubator-batchee with Apache License 2.0 5 votes vote down vote up
public void cleanupStoredBeanManagerOnShutdown(final @Observes BeforeShutdown beforeShutdown) {
    if (CDI_1_1_AVAILABLE || bmpSingleton == null) {
        return;
    }

    bmpSingleton.bmInfos.remove(loader());
}
 
Example #12
Source File: ConfigurationExtension.java    From deltaspike with Apache License 2.0 5 votes vote down vote up
/**
 * This method triggers freeing of the ConfigSources.
 */
@SuppressWarnings("UnusedDeclaration")
public void freeConfigSources(@Observes BeforeShutdown bs)
{
    String appName = ConfigResolver.getPropertyValue(ConfigResolver.DELTASPIKE_APP_NAME_CONFIG);
    unRegisterConfigMBean(appName);

    ConfigResolver.freeConfigSources();
    detectedParentPropertyFileConfigs.remove(ClassUtils.getClassLoader(null));

    // we also free the ClassDeactivationUtils cache
    ClassDeactivationUtils.clearCache();
}
 
Example #13
Source File: AxonCdiExtension.java    From cdi with Apache License 2.0 4 votes vote down vote up
void beforeShutdown(@Observes BeforeShutdown event, BeanManager beanManager) {
}
 
Example #14
Source File: JAXWSCdiExtension.java    From openwebbeans-meecrowave with Apache License 2.0 4 votes vote down vote up
public void release(@Observes final BeforeShutdown beforeShutdown) {
    impl.release(beforeShutdown);
}
 
Example #15
Source File: RepositoryExtension.java    From deltaspike with Apache License 2.0 4 votes vote down vote up
protected void cleanup(@Observes BeforeShutdown beforeShutdown)
{
    //we can reset it in any case,
    //because every application produced a copy as application-scoped bean (see RepositoryComponentsFactory)
    REPOSITORY_CLASSES.clear();
}
 
Example #16
Source File: ViewConfigExtension.java    From deltaspike with Apache License 2.0 4 votes vote down vote up
public void freeViewConfigCache(@Observes BeforeShutdown bs)
{
    this.viewConfigResolver = null;
    this.transformed = false;
}