Class TracingDaemonPool

  • All Implemented Interfaces:
    com.tangosol.internal.util.DaemonPool, ClassLoaderAware, Controllable

    public class TracingDaemonPool
    extends Object
    implements com.tangosol.internal.util.DaemonPool
    A DaemonPool implementation that wraps another DaemonPool and adds activation of tracing spans for the Runnables executed by this pool.
    Jonathan Knight 2020.01.10
    • Field Detail

      • f_delegate

        protected final com.tangosol.internal.util.DaemonPool f_delegate
        The DaemonPool to delegate to.
      • f_activeSpan

        protected final Supplier<io.opentracing.Span> f_activeSpan
        The Supplier that will provide active spans.
    • Constructor Detail

      • TracingDaemonPool

        public TracingDaemonPool​(com.tangosol.internal.util.DaemonPool delegate)
        delegate - the DaemonPool to delegate to
    • Method Detail

      • add

        public void add​(Runnable task)
        Description copied from interface: com.tangosol.internal.util.DaemonPool
        Adds a Runnable task to the DaemonPool.
        Specified by:
        add in interface com.tangosol.internal.util.DaemonPool
        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 interface com.tangosol.internal.util.DaemonPool
        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 interface com.tangosol.internal.util.DaemonPool
        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 interface Controllable
        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 interface com.tangosol.internal.util.DaemonPool
        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.DaemonPool
        Schedules the specified Runnable task for execution by the DaemonPool after the specified delay.
        Specified by:
        schedule in interface com.tangosol.internal.util.DaemonPool
        task - task to be scheduled
        cMillis - 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 the Controllable.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 interface Controllable
      • 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 interface Controllable
      • stop

        public void stop()
        Description copied from interface: Controllable
        Hard-stop the controllable service. Use Controllable.shutdown() for normal service termination. Calling this method for a service that has already stopped has no effect.
        Specified by:
        stop in interface Controllable
      • configure

        public void configure​(XmlElement xml)
        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 interface Controllable
        xml - an XmlElement carrying configuration information specific to the Controllable object
      • setContextClassLoader

        public void setContextClassLoader​(ClassLoader loader)
        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 interface ClassLoaderAware
        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 current Context.
        the current active span, or try to find the span in the current Context
      • getDelegate

        protected com.tangosol.internal.util.DaemonPool getDelegate()
        Returns the DaemonPool to delegate to.
        the DaemonPool to delegate to
      • ensureTracingDaemonPool

        public static TracingDaemonPool ensureTracingDaemonPool​(com.tangosol.internal.util.DaemonPool pool)
        Returns a TracingDaemonPool wrapping the specified pool.
        pool - the pool to wrap or return
        a TracingDaemonPool