Package org.jppf.execute
Interface ThreadManager
- All Known Implementing Classes:
AbstractThreadManager,ThreadManagerForkJoin,ThreadManagerThreadPool
public interface ThreadManager
Interface for all thread managers.
- Author:
- Laurent Cohen
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classHelper class for managing used class loaders. -
Method Summary
Modifier and TypeMethodDescriptionComputes the total CPU time used by the execution threads.computeExecutionInfo(long threadID) Computes the CPU time used by thread identified by threadID.static intcomputePoolSize(TypedProperties config, JPPFProperty<Integer> nbThreadsProperty) Compute a pool size based on the specified configuration and size property.longgetCpuTime(long threadId) Get the current cpu time for the thread identified by the specified id.Get the thread pool that really processes the tasksintGet the size of the node's thread pool.intGet the priority assigned to the execution threads.booleanDetermines whether the thread cpu time measurement is supported and enabled.static ThreadManagernewInstance(TypedProperties config, JPPFProperty<Integer> nbThreadsProperty) Create the thread manager instance.static longretrieveTTL(TypedProperties config, JPPFProperty<Long> ttlProperty) Compute a thread TTL based on the specified configuration and ttl property.voidsetPoolSize(int size) Set the size of the node's thread pool.voidsetPriority(int newPriority) Update the priority of all execution threads.useClassLoader(ClassLoader classLoader) Use class loader in this thread manager.
-
Method Details
-
setPoolSize
void setPoolSize(int size) Set the size of the node's thread pool.- Parameters:
size- the size as an int.
-
getPoolSize
int getPoolSize()Get the size of the node's thread pool.- Returns:
- the size as an int.
-
computeExecutionInfo
ExecutionInfo computeExecutionInfo()Computes the total CPU time used by the execution threads.- Returns:
- a
NodeExecutionInfoinstance.
-
computeExecutionInfo
Computes the CPU time used by thread identified by threadID.- Parameters:
threadID- the thread ID.- Returns:
- a
NodeExecutionInfoinstance.
-
getCpuTime
long getCpuTime(long threadId) Get the current cpu time for the thread identified by the specified id.- Parameters:
threadId- the id of the thread to the cpu time from.- Returns:
- the cpu time as a long value.
-
getPriority
int getPriority()Get the priority assigned to the execution threads.- Returns:
- the priority as an int value.
-
setPriority
void setPriority(int newPriority) Update the priority of all execution threads.- Parameters:
newPriority- the new priority to set.
-
getExecutorService
ExecutorService getExecutorService()Get the thread pool that really processes the tasks- Returns:
- a
ThreadPoolExecutorinstance.
-
isCpuTimeEnabled
boolean isCpuTimeEnabled()Determines whether the thread cpu time measurement is supported and enabled.- Returns:
- true is cpu time measurement is enabled, false otherwise.
-
newInstance
Create the thread manager instance. Default isThreadManagerThreadPool.- Parameters:
config- the configuration to get the thread manager properties from.nbThreadsProperty- the name of the property which configures the number of threads.- Returns:
- an instance of
ThreadManager.
-
computePoolSize
Compute a pool size based on the specified configuration and size property.- Parameters:
config- the config to read the property from.nbThreadsProperty- the property that configures the pool size.- Returns:
- the computed size.
-
retrieveTTL
Compute a thread TTL based on the specified configuration and ttl property.- Parameters:
config- the config to read the property from.ttlProperty- the property that configures the time to live of the threads.- Returns:
- the computed size.
-
useClassLoader
Use class loader in this thread manager.- Parameters:
classLoader- aClassLoaderinstance.- Returns:
- a
UsedClassLoaderinstance. Never returnnull.
-