Package org.jboss.util.threadpool
Class BlockingMode
- java.lang.Object
-
- org.jboss.util.threadpool.BlockingMode
-
- All Implemented Interfaces:
java.io.Serializable
public class BlockingMode extends java.lang.Object implements java.io.SerializableA type-safe enum for the BasicThreadPool blocking mode.- Version:
- $Revision$
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static BlockingModeABORTSet the policy for blocked execution to be to throw an AbortWhenBlocked (a subclass of RuntimeException).static intABORT_TYPEstatic BlockingModeDISCARDSet the policy for blocked execution to be to return without executing the request.static BlockingModeDISCARD_OLDESTSet the policy for blocked execution to be to discard the oldest unhandled requeststatic intDISCARD_OLDEST_TYPEstatic intDISCARD_TYPEprivate java.lang.StringnameThe string form of the enumstatic BlockingModeRUNSet the policy for blocked execution to be that the current thread executes the command if there are no available threads in the pool.static intRUN_TYPEprivate static longserialVersionUIDprivate inttypeThe enum manifest constantstatic BlockingModeWAITSet the policy for blocked execution to be to wait until a thread is available, unless the pool has been shut down, in which case the action is discarded.static intWAIT_TYPE
-
Constructor Summary
Constructors Modifier Constructor Description privateBlockingMode(java.lang.String name, int type)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) java.lang.ObjectreadResolve()Overriden to return the indentity instance of BlockingMode based on the stream type int value.static BlockingModetoBlockingMode(java.lang.String name)A utility method to convert a string name to a BlockingModejava.lang.StringtoString()
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- Since:
- 1.0
- See Also:
- Constant Field Values
-
RUN_TYPE
public static final int RUN_TYPE
- See Also:
- Constant Field Values
-
WAIT_TYPE
public static final int WAIT_TYPE
- See Also:
- Constant Field Values
-
DISCARD_TYPE
public static final int DISCARD_TYPE
- See Also:
- Constant Field Values
-
DISCARD_OLDEST_TYPE
public static final int DISCARD_OLDEST_TYPE
- See Also:
- Constant Field Values
-
ABORT_TYPE
public static final int ABORT_TYPE
- See Also:
- Constant Field Values
-
RUN
public static final BlockingMode RUN
Set the policy for blocked execution to be that the current thread executes the command if there are no available threads in the pool.
-
WAIT
public static final BlockingMode WAIT
Set the policy for blocked execution to be to wait until a thread is available, unless the pool has been shut down, in which case the action is discarded.
-
DISCARD
public static final BlockingMode DISCARD
Set the policy for blocked execution to be to return without executing the request.
-
DISCARD_OLDEST
public static final BlockingMode DISCARD_OLDEST
Set the policy for blocked execution to be to discard the oldest unhandled request
-
ABORT
public static final BlockingMode ABORT
Set the policy for blocked execution to be to throw an AbortWhenBlocked (a subclass of RuntimeException).
-
name
private final transient java.lang.String name
The string form of the enum
-
type
private final int type
The enum manifest constant
-
-
Method Detail
-
toBlockingMode
public static final BlockingMode toBlockingMode(java.lang.String name)
A utility method to convert a string name to a BlockingMode- Parameters:
name-- Returns:
- The associated BlockingMode constant if name is valid, null otherwise
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
readResolve
java.lang.Object readResolve() throws java.io.ObjectStreamExceptionOverriden to return the indentity instance of BlockingMode based on the stream type int value. This ensures that BlockingMode enums can be compared using ==.- Returns:
- The BlockingMode instance for the XXX_TYPE int.
- Throws:
java.io.ObjectStreamException
-
-