Package com.oracle.coherence.grpc
Class SimpleDaemonPoolExecutor
- java.lang.Object
-
- com.oracle.coherence.grpc.SimpleDaemonPoolExecutor
-
- All Implemented Interfaces:
ClassLoaderAware,Controllable,Executor
- Direct Known Subclasses:
DaemonPoolExecutor
public class SimpleDaemonPoolExecutor extends Object implements Executor, Controllable
AnExecutorthat uses aDaemonPoolto execute tasks.Instances of
SimpleDaemonPoolExecutorare created with aDaemonPoolthat is stopped. The executor should be started by calling thestart()method.Tasks submitted without calling start will be executed immediately on the calling thread.
- Since:
- 20.06
- Author:
- Jonathan Knight 2020.06.24
-
-
Field Summary
Fields Modifier and Type Field Description protected com.tangosol.internal.util.DaemonPoolf_poolTheDaemonPoolthat will be used to execute tasks.
-
Constructor Summary
Constructors Constructor Description SimpleDaemonPoolExecutor(com.tangosol.internal.util.DaemonPool pool)Create aSimpleDaemonPoolExecutor.SimpleDaemonPoolExecutor(com.tangosol.internal.util.DefaultDaemonPoolDependencies dependencies)SimpleDaemonPoolExecutor(String sName)SimpleDaemonPoolExecutor(String sName, int cThreads, int cThreadsMin, int cThreadsMax)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidconfigure(XmlElement xmlElement)Configure the controllable service.voidexecute(Runnable command)ClassLoadergetContextClassLoader()Retrieve the context ClassLoader for this object.com.tangosol.internal.util.DaemonPoolgetPool()Obtain the underlyingDaemonPool.booleanisRunning()Determine whether or not the controllable service is running.booleanisStuck()Returntrueif the pool is stuck.voidsetContextClassLoader(ClassLoader loader)Specify the context ClassLoader for this object.voidshutdown()Stop the controllable service.voidstart()Start the controllable service.voidstop()Hard-stop the controllable service.
-
-
-
Constructor Detail
-
SimpleDaemonPoolExecutor
public SimpleDaemonPoolExecutor(String sName)
-
SimpleDaemonPoolExecutor
public SimpleDaemonPoolExecutor(String sName, int cThreads, int cThreadsMin, int cThreadsMax)
-
SimpleDaemonPoolExecutor
public SimpleDaemonPoolExecutor(com.tangosol.internal.util.DefaultDaemonPoolDependencies dependencies)
-
SimpleDaemonPoolExecutor
public SimpleDaemonPoolExecutor(com.tangosol.internal.util.DaemonPool pool)
Create aSimpleDaemonPoolExecutor.- Parameters:
pool- theDaemonPoolto use
-
-
Method Detail
-
configure
public void configure(XmlElement xmlElement)
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:
xmlElement- an XmlElement carrying configuration information specific to the Controllable object
-
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
-
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()
Returntrueif the pool is stuck.- Returns:
trueif the pool is stuck
-
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
-
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
-
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
-
getPool
public com.tangosol.internal.util.DaemonPool getPool()
Obtain the underlyingDaemonPool.- Returns:
- the underlying
DaemonPool
-
-