org.jppf.utils
Class JPPFThreadFactory

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

public class JPPFThreadFactory
extends Object
implements ThreadFactory

Custom thread factory used mostly to specifiy th enames of created threads.

Author:
Laurent Cohen

Constructor Summary
JPPFThreadFactory(String name)
          Initialize this thread factory with the specified name.
JPPFThreadFactory(String name, boolean monitoringEnabled)
          Initialize this thread factory with the specified name.
JPPFThreadFactory(String name, boolean monitoringEnabled, int priority)
          Initialize this thread factory with the specified name.
JPPFThreadFactory(String name, int priority)
          Initialize this thread factory with the specified name.
 
Method Summary
 int getPriority()
          Get the priority assigned to the threads created by this factory.
 List<Long> getThreadIDs()
          Get the ids of the monitored threads.
 Thread newThread(Runnable r)
          Constructs a new Thread.
 void updatePriority(int newPriority)
          Update the priority of all threads created by this factory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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,
                         int priority)
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.
Method Detail

newThread

public Thread newThread(Runnable r)
Constructs a new Thread.

Specified by:
newThread in interface ThreadFactory
Parameters:
r - a runnable to be executed by the new thread instance.
Returns:
the constructed thread.
See Also:
ThreadFactory.newThread(java.lang.Runnable)

getThreadIDs

public List<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.


Copyright © 2005-2010 JPPF Team.