public class Adept2ThreadFactory
extends java.lang.Object
implements java.util.concurrent.ThreadFactory, java.lang.Thread.UncaughtExceptionHandler
Executors.defaultThreadFactory()| Modifier and Type | Field and Description |
|---|---|
protected java.lang.Runnable |
cleanup
The cleanup runnable injected into all created threads to be executed just
before the thread terminates.
|
protected boolean |
daemon
Whether to create daemon threads.
|
protected java.lang.ThreadGroup |
group
The group for the threads.
|
protected java.util.logging.Logger |
logger
Logger for logging uncaught exceptions.
|
protected java.lang.String |
namePrefix
The prefix of the thread name, naming the user of this thread factory.
|
protected static java.util.concurrent.atomic.AtomicInteger |
poolNumber
The counter for the pools.
|
protected int |
priority
The priority for the created threads.
|
protected long |
stackSize
The desired stack size (in Bytes) for any new thread in bytes of address
space.
|
protected java.util.concurrent.atomic.AtomicInteger |
threadNumber
The counter for the threads.
|
| Constructor and Description |
|---|
Adept2ThreadFactory(java.lang.String name,
boolean daemon,
java.util.logging.Logger logger)
Creates a new thread factory with the designated name, a default stack size,
a priority one less than normal.
|
Adept2ThreadFactory(java.lang.String name,
int priority,
java.util.logging.Logger logger)
Creates a new thread factory with the designated parameters and a default
stack size for non-daemon threads.
|
Adept2ThreadFactory(java.lang.String name,
java.util.logging.Logger logger)
Creates a new thread factory with the designated name, a default stack size
and a priority one less than normal.
|
Adept2ThreadFactory(java.lang.String name,
long stackSize,
int priority,
boolean daemon,
java.util.logging.Logger logger)
Creates a new thread factory with the designated parameters.
|
Adept2ThreadFactory(java.lang.String name,
long stackSize,
int priority,
boolean daemon,
java.lang.Runnable cleanup,
java.util.logging.Logger logger)
Creates a new thread factory with the designated parameters.
|
Adept2ThreadFactory(java.lang.String name,
long stackSize,
int priority,
java.util.logging.Logger logger)
Creates a new thread factory with the designated parameters for non-daemon
threads.
|
Adept2ThreadFactory(java.lang.String name,
long stackSize,
java.util.logging.Logger logger)
Creates a new thread factory with the designated parameters and a priority
one less than normal and non-daemon threads.
|
Adept2ThreadFactory(java.lang.String name,
java.lang.Runnable cleanup,
java.util.logging.Logger logger)
Creates a new thread factory with the designated name, a default stack size
and a priority one less than normal.
|
| Modifier and Type | Method and Description |
|---|---|
java.util.logging.Logger |
getLogger()
Gets the logger this factory uses for uncaught exceptions.
|
java.lang.String |
getNamePrefix()
Gets the name prefix this factory uses for new threads.
|
java.lang.Thread |
newThread(java.lang.Runnable r) |
void |
uncaughtException(java.lang.Thread t,
java.lang.Throwable e) |
protected static final java.util.concurrent.atomic.AtomicInteger poolNumber
protected final java.lang.ThreadGroup group
protected final java.util.concurrent.atomic.AtomicInteger threadNumber
protected final java.lang.String namePrefix
protected final long stackSize
protected final int priority
protected final boolean daemon
protected final java.lang.Runnable cleanup
protected final java.util.logging.Logger logger
public Adept2ThreadFactory(java.lang.String name,
java.util.logging.Logger logger)
name - The name of the pool, used to identify the threadlogger - The logger of the caller, to which uncaught exceptions are
going to be logged.public Adept2ThreadFactory(java.lang.String name,
java.lang.Runnable cleanup,
java.util.logging.Logger logger)
name - The name of the pool, used to identify the threadcleanup - A cleanup runnable injected into all created threads to be
executed just before the thread terminates.logger - The logger of the caller, to which uncaught exceptions are
going to be logged.public Adept2ThreadFactory(java.lang.String name,
boolean daemon,
java.util.logging.Logger logger)
name - The name of the pool, used to identify the threadlogger - The logger of the caller, to which uncaught exceptions are
going to be logged.daemon - Whether to create daemon threads.public Adept2ThreadFactory(java.lang.String name,
long stackSize,
java.util.logging.Logger logger)
name - The name of the pool, used to identify the threadstackSize - The desired stack size (in KiB) for the new thread, or
zero to indicate that this parameter is to be ignored.logger - The logger of the caller, to which uncaught exceptions are
going to be logged.public Adept2ThreadFactory(java.lang.String name,
int priority,
java.util.logging.Logger logger)
name - The name of the pool, used to identify the threadpriority - The priority of the created threads.logger - The logger of the caller, to which uncaught exceptions are
going to be logged.public Adept2ThreadFactory(java.lang.String name,
long stackSize,
int priority,
java.util.logging.Logger logger)
name - The name of the pool, used to identify the threadstackSize - The desired stack size (in KiB) for the new thread, or
zero to indicate that this parameter is to be ignored.priority - The priority of the created threads. If this is lower than
Thread.MIN_PRIORITY, Thread.MIN_PRIORITY
will be used, the same applies inversely to
Thread.MAX_PRIORITY.logger - The logger of the caller, to which uncaught exceptions are
going to be logged.public Adept2ThreadFactory(java.lang.String name,
long stackSize,
int priority,
boolean daemon,
java.util.logging.Logger logger)
name - The name of the pool, used to identify the threadstackSize - The desired stack size (in KiB) for the new thread, or
zero to indicate that this parameter is to be ignored.priority - The priority of the created threads. If this is lower than
Thread.MIN_PRIORITY, Thread.MIN_PRIORITY
will be used, the same applies inversely to
Thread.MAX_PRIORITY.daemon - Whether to create daemon threads.logger - The logger of the caller, to which uncaught exceptions are
going to be logged.public Adept2ThreadFactory(java.lang.String name,
long stackSize,
int priority,
boolean daemon,
java.lang.Runnable cleanup,
java.util.logging.Logger logger)
name - The name of the pool, used to identify the threadstackSize - The desired stack size (in KiB) for the new thread, or
zero to indicate that this parameter is to be ignored.priority - The priority of the created threads. If this is lower than
Thread.MIN_PRIORITY, Thread.MIN_PRIORITY
will be used, the same applies inversely to
Thread.MAX_PRIORITY.daemon - Whether to create daemon threads.cleanup - A cleanup runnable injected into all created threads to be
executed just before the thread terminates.logger - The logger of the caller, to which uncaught exceptions are
going to be logged.public java.lang.Thread newThread(java.lang.Runnable r)
newThread in interface java.util.concurrent.ThreadFactorypublic void uncaughtException(java.lang.Thread t,
java.lang.Throwable e)
uncaughtException in interface java.lang.Thread.UncaughtExceptionHandlerpublic java.lang.String getNamePrefix()
public java.util.logging.Logger getLogger()