Package co.elastic.apm.agent.context
Class ClosableLifecycleListenerAdapter
- java.lang.Object
-
- co.elastic.apm.agent.context.AbstractLifecycleListener
-
- co.elastic.apm.agent.context.ClosableLifecycleListenerAdapter
-
- All Implemented Interfaces:
LifecycleListener
public class ClosableLifecycleListenerAdapter extends AbstractLifecycleListener
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static LifecycleListenerof(java.io.Closeable closeable)voidstop()Callback for whenElasticApmTracer.stop()has been called.-
Methods inherited from class co.elastic.apm.agent.context.AbstractLifecycleListener
init, pause, resume, start
-
-
-
-
Method Detail
-
of
public static LifecycleListener of(java.io.Closeable closeable)
-
stop
public void stop() throws java.lang.ExceptionDescription copied from interface:LifecycleListenerCallback for whenElasticApmTracer.stop()has been called.Typically, this method is used to clean up resources like thread pools so that there are no class loader leaks when a webapp is redeployed in an application server.
Exceptions thrown from this method are caught and handled so that they don't prevent further cleanup actions.
The order of the shutdown process is as follows:
-
The
LifecycleListener.stop()method of all lifecycle listeners is called. The order in which lifecycle listeners are called is non-deterministic. -
The
ElasticApmTracer.getSharedSingleThreadedPool()is shut down gracefully, waiting a moment for the already scheduled tasks to be completed. This means that implementations of this method can schedule a last command to this pool that is executed before shutdown. TheTracer.getState()will still beTracer.TracerState.RUNNINGin the tasks scheduled toElasticApmTracer.getSharedSingleThreadedPool()within this method. -
The tracer state is set to
Tracer.TracerState.STOPPED. -
The
Reporteris closed.
- Specified by:
stopin interfaceLifecycleListener- Overrides:
stopin classAbstractLifecycleListener- Throws:
java.lang.Exception- When something goes wrong performing the cleanup.
-
The
-
-