Class ThreadPoolProvider

  • All Implemented Interfaces:
    com.yahoo.component.Component, com.yahoo.component.Deconstructable, com.yahoo.container.di.componentgraph.Provider<java.util.concurrent.Executor>, java.lang.Comparable<com.yahoo.component.Component>

    public class ThreadPoolProvider
    extends com.yahoo.component.AbstractComponent
    implements com.yahoo.container.di.componentgraph.Provider<java.util.concurrent.Executor>
    A configurable thread pool provider. This provides the worker threads used for normal request processing. Request an Executor injected in your component constructor if you want to use it.
    Author:
    Steinar Knutsen, baldersheim, bratseth
    • Field Summary

      • Fields inherited from class com.yahoo.component.AbstractComponent

        isDeconstructable
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void deconstruct()
      Shut down the thread pool, give a grace period of 1 second before forcibly shutting down all worker threads.
      java.util.concurrent.Executor get()
      Get the Executor provided by this class.
      • Methods inherited from class com.yahoo.component.AbstractComponent

        clone, compareTo, getClassName, getId, getIdString, hasInitializedId, initId, isDeconstructable, setIsDeconstructable, toString
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • ThreadPoolProvider

        @Inject
        public ThreadPoolProvider​(ThreadpoolConfig config,
                                  com.yahoo.jdisc.Metric metric)
    • Method Detail

      • get

        public java.util.concurrent.Executor get()
        Get the Executor provided by this class. This Executor will by default also be used for search queries and processing requests.
        Specified by:
        get in interface com.yahoo.container.di.componentgraph.Provider<java.util.concurrent.Executor>
        Returns:
        a possibly shared executor
      • deconstruct

        public void deconstruct()
        Shut down the thread pool, give a grace period of 1 second before forcibly shutting down all worker threads.
        Specified by:
        deconstruct in interface com.yahoo.component.Deconstructable
        Overrides:
        deconstruct in class com.yahoo.component.AbstractComponent