public enum ThreadType extends java.lang.Enum<ThreadType>
parks
for the nanosecond time.
parks
for an indefinite time.
Enum Constant and Description |
---|
BLOCKING
The thread blocks while waiting for the desired event
to occur.
|
SPINNING
The thread repeatedly checks if the event has arrived
using a non-blocking call without pausing in between
checks.
|
SPINPARK
This thread repeatedly checks for the event using a
non-blocking call but only for a fixed number of times
(the spin limit).
|
SPINYIELD
This thread repeatedly check for the event using a
non-blocking call but only for a fixed number of times
(the spin limit).
|
Modifier and Type | Method and Description |
---|---|
static ThreadType |
find(java.lang.String s)
Returns the thread type with a text name equaling
s , ignoring case. |
java.lang.String |
textName()
Returns the thread type text name.
|
java.lang.String |
toString() |
static ThreadType |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static ThreadType[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final ThreadType BLOCKING
public static final ThreadType SPINNING
public static final ThreadType SPINPARK
parks
for a specified nanosecond time limit. Upon waking up,
the threads resets the spin count and starts the repeated,
non-blocking checks again. This continues until an event
is detected.
This type is a compromise between blocking and spinning by aggressively spinning until the event occurs but not entirely monopolizing a core. By parking, the thread may be moved off core but not as likely as in a blocking thread.
public static final ThreadType SPINYIELD
yields
the core to another thread. When the thread re-gains the
core, the the spin count is reset and the repeated,
non-blocking checks start again. This continues until an
event is detected.
This type is a compromise between blocking and spinning by aggressively spinning until an event occurs but not entirely monopolizing a core. By yielding, the thread may be moved off core but not as likely as in a blocking thread.
public static ThreadType[] values()
for (ThreadType c : ThreadType.values()) System.out.println(c);
public static ThreadType valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic java.lang.String toString()
toString
in class java.lang.Enum<ThreadType>
public java.lang.String textName()
public static ThreadType find(java.lang.String s)
s
, ignoring case. Will return null
if
s
does not match any thread type text name.s
- compare the thread type text name to this given
value.Copyright © 2001 - 2024. Charles W. Rapp. All rights reserved.