Package org.jppf.utils.concurrent
Class JPPFThreadFactory
java.lang.Object
org.jppf.utils.concurrent.JPPFThreadFactory
- All Implemented Interfaces:
ThreadFactory
Custom thread factory used mostly to specify the names of created threads.
- Author:
- Laurent Cohen
-
Constructor Summary
ConstructorsConstructorDescriptionJPPFThreadFactory(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, boolean daemon) Initialize this thread factory with the specified name.JPPFThreadFactory(String name, boolean monitoringEnabled, int priority, boolean doPrivileged, boolean daemon) Initialize this thread factory with the specified name.JPPFThreadFactory(String name, int priority) Initialize this thread factory with the specified name. -
Method Summary
Modifier and TypeMethodDescriptionintGet the priority assigned to the threads created by this factory.long[]Get the ids of the monitored threads.voidupdatePriority(int newPriority) Update the priority of all threads created by this factory.
-
Constructor Details
-
JPPFThreadFactory
Initialize this thread factory with the specified name.- Parameters:
name- the name used as prefix for the constructed threads name.
-
JPPFThreadFactory
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
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
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
- Specified by:
newThreadin interfaceThreadFactory
-
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.
-