Class JPPFThreadFactory

java.lang.Object
org.jppf.utils.concurrent.JPPFThreadFactory
All Implemented Interfaces:
ThreadFactory

public class JPPFThreadFactory extends Object implements ThreadFactory
Custom thread factory used mostly to specify the names of created threads.
Author:
Laurent Cohen
  • Constructor Details

    • JPPFThreadFactory

      public JPPFThreadFactory(String name)
      Initialize this thread factory with the specified name.
      Parameters:
      name - the name used as prefix for the constructed threads name.
    • JPPFThreadFactory

      public JPPFThreadFactory(String name, int priority)
      Initialize this thread factory with the specified name.
      Parameters:
      name - the name used as prefix for the constructed threads name.
      priority - priority assigned to the threads created by this factory.
    • JPPFThreadFactory

      public JPPFThreadFactory(String name, boolean monitoringEnabled)
      Initialize this thread factory with the specified name.
      Parameters:
      name - the name used as prefix for the constructed threads name.
      monitoringEnabled - determines whether the threads created by this factory can be monitored.
    • JPPFThreadFactory

      public JPPFThreadFactory(String name, boolean monitoringEnabled, boolean daemon)
      Initialize this thread factory with the specified name.
      Parameters:
      name - the name used as prefix for the constructed threads name.
      monitoringEnabled - determines whether the threads created by this factory can be monitored.
      daemon - whether created threads are daemon threads.
    • JPPFThreadFactory

      public JPPFThreadFactory(String name, boolean monitoringEnabled, int priority, boolean doPrivileged, boolean daemon)
      Initialize this thread factory with the specified name.
      Parameters:
      name - the name used as prefix for the constructed threads name.
      monitoringEnabled - determines whether the threads created by this factory can be monitored.
      priority - priority assigned to the threads created by this factory.
      doPrivileged - indicates whether thread should be created in PrivilegedAction.
      daemon - whether created threads are daemon threads.
  • Method Details

    • newThread

      public Thread newThread(Runnable r)
      Specified by:
      newThread in interface ThreadFactory
    • getThreadIDs

      public long[] getThreadIDs()
      Get the ids of the monitored threads.
      Returns:
      a list of long values.
    • updatePriority

      public void updatePriority(int newPriority)
      Update the priority of all threads created by this factory.
      Parameters:
      newPriority - the new priority to set.
    • getPriority

      public int getPriority()
      Get the priority assigned to the threads created by this factory.
      Returns:
      the priority as an int value.