Interface ThreadManager

All Known Implementing Classes:
AbstractThreadManager, ThreadManagerForkJoin, ThreadManagerThreadPool

public interface ThreadManager
Interface for all thread managers.
Author:
Laurent Cohen
  • 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 NodeExecutionInfo instance.
    • computeExecutionInfo

      ExecutionInfo computeExecutionInfo(long threadID)
      Computes the CPU time used by thread identified by threadID.
      Parameters:
      threadID - the thread ID.
      Returns:
      a NodeExecutionInfo instance.
    • 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 ThreadPoolExecutor instance.
    • 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

      static ThreadManager newInstance(TypedProperties config, JPPFProperty<Integer> nbThreadsProperty)
      Create the thread manager instance. Default is ThreadManagerThreadPool.
      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

      static int computePoolSize(TypedProperties config, JPPFProperty<Integer> nbThreadsProperty)
      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

      static long retrieveTTL(TypedProperties config, JPPFProperty<Long> ttlProperty)
      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

      ThreadManager.UsedClassLoader useClassLoader(ClassLoader classLoader)
      Use class loader in this thread manager.
      Parameters:
      classLoader - a ClassLoader instance.
      Returns:
      a UsedClassLoader instance. Never return null.