public class NamedTimer
extends java.util.Timer
Timer
that also allows configuring the name and
priority of the underlying timer thread.
Note: Since Java 2 Platform SE 5.0, the Timer
API provides
constructors which set the name of the thread. This class may still be
useful if you want to set the timer thread priority.
Constructor and Description |
---|
NamedTimer(java.lang.String name)
Constructs a new non-daemon
NamedTimer with the specified
name. |
NamedTimer(java.lang.String name,
int priority)
Constructs a new non-daemon
NamedTimer with the specified
name and priority. |
NamedTimer(java.lang.String name,
int priority,
boolean isDaemon)
Constructs a new
NamedTimer with the specified name,
priority, and daemon status. |
Modifier and Type | Method and Description |
---|---|
static NamedTimer |
getSharedLowPriorityTimer() |
public NamedTimer(java.lang.String name)
NamedTimer
with the specified
name.name
- The name for the underlying timer thread.Thread
public NamedTimer(java.lang.String name, int priority)
NamedTimer
with the specified
name and priority.name
- The name for the underlying timer thread.priority
- The priority for the underlying timer thread.java.lang.IllegalArgumentException
- If the priority is not one of Thread.MIN_PRIORITY
, Thread.NORM_PRIORITY
, or Thread.MAX_PRIORITY
.Thread
public NamedTimer(java.lang.String name, int priority, boolean isDaemon)
NamedTimer
with the specified name,
priority, and daemon status.name
- The name for the underlying timer thread.priority
- The priority for the underlying timer thread.isDaemon
- true
if the underlying thread should be
run as a daemon.java.lang.IllegalArgumentException
- If the priority is not one of Thread.MIN_PRIORITY
, Thread.NORM_PRIORITY
, or Thread.MAX_PRIORITY
.Thread
public static NamedTimer getSharedLowPriorityTimer()