Search in sources :

Example 1 with ComponentRequestLifecycle

use of org.exoplatform.container.component.ComponentRequestLifecycle in project kernel by exoplatform.

the class JobEnvironmentConfigListener method jobWasExecuted.

public void jobWasExecuted(JobExecutionContext context, JobExecutionException exception) {
    String containerName = extractContainerName(context);
    ExoContainer container = null;
    if (containerName != null) {
        if (containerName.equals(JobSchedulerServiceImpl.STANDALONE_CONTAINER_NAME)) {
            container = ExoContainerContext.getTopContainer();
        } else {
            RootContainer rootContainer = RootContainer.getInstance();
            container = (ExoContainer) rootContainer.getComponentInstance(containerName);
        }
    }
    if (container != null) {
        List<ComponentRequestLifecycle> components = container.getComponentInstancesOfType(ComponentRequestLifecycle.class);
        for (ComponentRequestLifecycle component : components) {
            component.endRequest(container);
        }
        RequestLifeCycle.end();
        ExoContainerContext.setCurrentContainer(null);
    }
}
Also used : ExoContainer(org.exoplatform.container.ExoContainer) RootContainer(org.exoplatform.container.RootContainer) ComponentRequestLifecycle(org.exoplatform.container.component.ComponentRequestLifecycle)

Aggregations

ExoContainer (org.exoplatform.container.ExoContainer)1 RootContainer (org.exoplatform.container.RootContainer)1 ComponentRequestLifecycle (org.exoplatform.container.component.ComponentRequestLifecycle)1