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
A
DaemonPool
implementation that wraps another
DaemonPool
and adds activation of tracing spans
for the Runnable
s executed by this pool.- Since:
- 20.06
- Author:
- Jonathan Knight 2020.01.10
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static class
ARunnable
that executes another runnable after activating a tracing span. -
Field Summary
Modifier and TypeFieldDescriptionprotected final Supplier
<io.opentracing.Span> TheSupplier
that will provide active spans.protected final com.tangosol.internal.util.DaemonPool
TheDaemonPool
to delegate to.Fields inherited from interface com.tangosol.internal.util.DaemonPool
COMMON_POOL_BUILDER_NAME
-
Constructor Summary
ConstructorDescriptionTracingDaemonPool
(com.tangosol.internal.util.DaemonPool delegate) Create aTracingDaemonPool
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a Runnable task to the DaemonPool.void
configure
(XmlElement xml) Configure the controllable service.static TracingDaemonPool
ensureTracingDaemonPool
(com.tangosol.internal.util.DaemonPool pool) Returns aTracingDaemonPool
wrapping the specified pool.protected io.opentracing.Span
findSpan()
Return the current active span, or try to find the span in the currentContext
.Retrieve the context ClassLoader for this object.protected com.tangosol.internal.util.DaemonPool
Returns theDaemonPool
to delegate to.com.tangosol.internal.util.DaemonPoolDependencies
Return the external dependencies of this DaemonPool.boolean
Determine whether or not the controllable service is running.boolean
isStuck()
Determine if this DaemonPool has not made progress since the last time this method was called.void
Schedules the specified Runnable task for execution by the DaemonPool after the specified delay.void
setContextClassLoader
(ClassLoader loader) Specify the context ClassLoader for this object.void
setDependencies
(com.tangosol.internal.util.DaemonPoolDependencies deps) Configure the external dependencies of this DaemonPool.void
shutdown()
Stop the controllable service.void
start()
Start the controllable service.void
stop()
Hard-stop the controllable service.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.tangosol.internal.util.DaemonPool
execute, getGuardian
-
Field Details
-
f_delegate
protected final com.tangosol.internal.util.DaemonPool f_delegateTheDaemonPool
to delegate to. -
f_activeSpan
TheSupplier
that will provide active spans.
-
-
Constructor Details
-
TracingDaemonPool
public TracingDaemonPool(com.tangosol.internal.util.DaemonPool delegate) Create aTracingDaemonPool
.- Parameters:
delegate
- theDaemonPool
to delegate to
-
-
Method Details
-
add
Description copied from interface:com.tangosol.internal.util.DaemonPool
Adds a Runnable task to the DaemonPool.- Specified by:
add
in 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.DaemonPool
Return the external dependencies of this DaemonPool.- Specified by:
getDependencies
in 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.DaemonPool
Configure the external dependencies of this DaemonPool.- Specified by:
setDependencies
in interfacecom.tangosol.internal.util.DaemonPool
- Parameters:
deps
- the external dependencies
-
isRunning
public boolean isRunning()Description copied from interface:Controllable
Determine 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:
isRunning
in interfaceControllable
- Returns:
- true if the service is running; false otherwise
-
isStuck
public boolean isStuck()Description copied from interface:com.tangosol.internal.util.DaemonPool
Determine if this DaemonPool has not made progress since the last time this method was called.- Specified by:
isStuck
in interfacecom.tangosol.internal.util.DaemonPool
- Returns:
- true iff this DaemonPool has not made progress since the last time this method was called
-
schedule
Description copied from interface:com.tangosol.internal.util.DaemonPool
Schedules the specified Runnable task for execution by the DaemonPool after the specified delay.- Specified by:
schedule
in 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:Controllable
Stop 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:
shutdown
in interfaceControllable
-
start
public void start()Description copied from interface:Controllable
Start 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:
start
in interfaceControllable
-
stop
public void stop()Description copied from interface:Controllable
Hard-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:
stop
in interfaceControllable
-
configure
Description copied from interface:Controllable
Configure the controllable service.This method can only be called before the controllable service is started.
- Specified by:
configure
in interfaceControllable
- Parameters:
xml
- an XmlElement carrying configuration information specific to the Controllable object
-
getContextClassLoader
Description copied from interface:ClassLoaderAware
Retrieve 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:
getContextClassLoader
in interfaceClassLoaderAware
- Returns:
- the context ClassLoader for this object
- See Also:
-
setContextClassLoader
Description copied from interface:ClassLoaderAware
Specify 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:
setContextClassLoader
in 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 theDaemonPool
to delegate to.- Returns:
- the
DaemonPool
to delegate to
-
ensureTracingDaemonPool
Returns aTracingDaemonPool
wrapping the specified pool.- Parameters:
pool
- the pool to wrap or return- Returns:
- a
TracingDaemonPool
-