Package com.oracle.coherence.grpc.proxy
Class TracingDaemonPool
- java.lang.Object
-
- com.oracle.coherence.grpc.proxy.TracingDaemonPool
-
- All Implemented Interfaces:
com.tangosol.internal.util.DaemonPool,ClassLoaderAware,Controllable,Executor
public class TracingDaemonPool extends Object implements com.tangosol.internal.util.DaemonPool
ADaemonPoolimplementation that wraps anotherDaemonPooland adds activation of tracing spans for theRunnables executed by this pool.- Since:
- 20.06
- Author:
- Jonathan Knight 2020.01.10
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classTracingDaemonPool.TracingRunnableARunnablethat executes another runnable after activating a tracing span.
-
Field Summary
Fields Modifier and Type Field Description protected Supplier<io.opentracing.Span>f_activeSpanTheSupplierthat will provide active spans.protected com.tangosol.internal.util.DaemonPoolf_delegateTheDaemonPoolto delegate to.
-
Constructor Summary
Constructors Constructor Description TracingDaemonPool(com.tangosol.internal.util.DaemonPool delegate)Create aTracingDaemonPool.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(Runnable task)Adds a Runnable task to the DaemonPool.voidconfigure(XmlElement xml)Configure the controllable service.static TracingDaemonPoolensureTracingDaemonPool(com.tangosol.internal.util.DaemonPool pool)Returns aTracingDaemonPoolwrapping the specified pool.protected io.opentracing.SpanfindSpan()Return the current active span, or try to find the span in the currentContext.ClassLoadergetContextClassLoader()Retrieve the context ClassLoader for this object.protected com.tangosol.internal.util.DaemonPoolgetDelegate()Returns theDaemonPoolto delegate to.com.tangosol.internal.util.DaemonPoolDependenciesgetDependencies()Return the external dependencies of this DaemonPool.booleanisRunning()Determine whether or not the controllable service is running.booleanisStuck()Determine if this DaemonPool has not made progress since the last time this method was called.voidschedule(Runnable task, long cMillis)Schedules the specified Runnable task for execution by the DaemonPool after the specified delay.voidsetContextClassLoader(ClassLoader loader)Specify the context ClassLoader for this object.voidsetDependencies(com.tangosol.internal.util.DaemonPoolDependencies deps)Configure the external dependencies of this DaemonPool.voidshutdown()Stop the controllable service.voidstart()Start the controllable service.voidstop()Hard-stop the controllable service.
-
-
-
Constructor Detail
-
TracingDaemonPool
public TracingDaemonPool(com.tangosol.internal.util.DaemonPool delegate)
Create aTracingDaemonPool.- Parameters:
delegate- theDaemonPoolto delegate to
-
-
Method Detail
-
add
public void add(Runnable task)
Description copied from interface:com.tangosol.internal.util.DaemonPoolAdds a Runnable task to the DaemonPool.- Specified by:
addin interfacecom.tangosol.internal.util.DaemonPool- Parameters:
task- the Runnable task to execute (call the run() method of) on one of the daemon threads
-
getDependencies
public com.tangosol.internal.util.DaemonPoolDependencies getDependencies()
Description copied from interface:com.tangosol.internal.util.DaemonPoolReturn the external dependencies of this DaemonPool.- Specified by:
getDependenciesin interfacecom.tangosol.internal.util.DaemonPool- Returns:
- the external dependencies
-
setDependencies
public void setDependencies(com.tangosol.internal.util.DaemonPoolDependencies deps)
Description copied from interface:com.tangosol.internal.util.DaemonPoolConfigure the external dependencies of this DaemonPool.- Specified by:
setDependenciesin interfacecom.tangosol.internal.util.DaemonPool- Parameters:
deps- the external dependencies
-
isRunning
public boolean isRunning()
Description copied from interface:ControllableDetermine whether or not the controllable service is running. This method returns false before a service is started, while the service is starting, while a service is shutting down and after the service has stopped. It only returns true after completing its start processing and before beginning its shutdown processing.- Specified by:
isRunningin interfaceControllable- Returns:
- true if the service is running; false otherwise
-
isStuck
public boolean isStuck()
Description copied from interface:com.tangosol.internal.util.DaemonPoolDetermine if this DaemonPool has not made progress since the last time this method was called.- Specified by:
isStuckin interfacecom.tangosol.internal.util.DaemonPool- Returns:
- true iff this DaemonPool has not made progress since the last time this method was called
-
schedule
public void schedule(Runnable task, long cMillis)
Description copied from interface:com.tangosol.internal.util.DaemonPoolSchedules the specified Runnable task for execution by the DaemonPool after the specified delay.- Specified by:
schedulein interfacecom.tangosol.internal.util.DaemonPool- Parameters:
task- task to be scheduledcMillis- delay in milliseconds before task is to be executed by this DaemonPool
-
shutdown
public void shutdown()
Description copied from interface:ControllableStop the controllable service. This is a controlled shut-down, and is preferred to theControllable.stop()method.This method should only be called once per the life cycle of the controllable service. Calling this method for a service that has already stopped has no effect.
- Specified by:
shutdownin interfaceControllable
-
start
public void start()
Description copied from interface:ControllableStart the controllable service.This method should only be called once per the life cycle of the Controllable service. This method has no affect if the service is already running.
- Specified by:
startin interfaceControllable
-
stop
public void stop()
Description copied from interface:ControllableHard-stop the controllable service. UseControllable.shutdown()for normal service termination. Calling this method for a service that has already stopped has no effect.- Specified by:
stopin interfaceControllable
-
configure
public void configure(XmlElement xml)
Description copied from interface:ControllableConfigure the controllable service.This method can only be called before the controllable service is started.
- Specified by:
configurein interfaceControllable- Parameters:
xml- an XmlElement carrying configuration information specific to the Controllable object
-
getContextClassLoader
public ClassLoader getContextClassLoader()
Description copied from interface:ClassLoaderAwareRetrieve the context ClassLoader for this object. The context ClassLoader is provided by the creator of the object for use by the object when loading classes and resources.- Specified by:
getContextClassLoaderin interfaceClassLoaderAware- Returns:
- the context ClassLoader for this object
- See Also:
Thread.getContextClassLoader()
-
setContextClassLoader
public void setContextClassLoader(ClassLoader loader)
Description copied from interface:ClassLoaderAwareSpecify the context ClassLoader for this object. The context ClassLoader can be set when the object is created, and allows the creator to provide the appropriate class loader to be used by the object when when loading classes and resources.- Specified by:
setContextClassLoaderin interfaceClassLoaderAware- Parameters:
loader- the context ClassLoader for this object
-
findSpan
protected io.opentracing.Span findSpan()
Return the current active span, or try to find the span in the currentContext.- Returns:
- the current active span, or try to find the span in the current
Context
-
getDelegate
protected com.tangosol.internal.util.DaemonPool getDelegate()
Returns theDaemonPoolto delegate to.- Returns:
- the
DaemonPoolto delegate to
-
ensureTracingDaemonPool
public static TracingDaemonPool ensureTracingDaemonPool(com.tangosol.internal.util.DaemonPool pool)
Returns aTracingDaemonPoolwrapping the specified pool.- Parameters:
pool- the pool to wrap or return- Returns:
- a
TracingDaemonPool
-
-