public class FailureReason extends Object
eventProcessingFailed
callback method.
A SLEE vendor may define any implementation-specific reason codes that may be useful or appropriate by extending this class. The integer representation of implementation-specific event codes must be positive numbers greater than zero. The OTHER REASON reason code has the reserved value 0, while negative numbers are reserved for the remainder of the standard reason codes defined in this class.
A singleton instance of each enumerated value defined in this class is guaranteed (via
an implementation of readResolve()
- refer
java.io.Serializable
), so that equality tests using
==
are always evaluated correctly. (This equality test is only guaranteed
if this class is loaded in the application's boot class path, rather than dynamically
loaded at runtime.) However, it must also be noted that for any vendor-defined reason
code, the isOtherReason()
will return true
, while the
FailureReason
(or subclass of FailureReason
) object representing
the vendor-defined reason code will not be equal, using the ==
operator or the equals
method, to OTHER_REASON
.
Modifier and Type | Field and Description |
---|---|
static FailureReason |
EVENT_MARSHALING_ERROR
Event failure reason indicating the event could not be marshaled by the resource adaptor
entity's
Marshaler . |
static FailureReason |
EVENT_QUEUE_FULL
Event failure reason indicating the event could not be enqueued for processing because the
event queue is full.
|
static FailureReason |
EVENT_QUEUE_TIMEOUT
Event failure reason indicating the event timeout period for processing of the event (if
supported by the SLEE) expired before the event could be processed.
|
static FailureReason |
FIRING_TRANSACTION_ROLLED_BACK
Event failure reason indicating the transaction in which the event was fired
rolled back.
|
static FailureReason |
OTHER_REASON
Event failure reason indicating that the event could not be processed for an other reason.
|
static int |
REASON_EVENT_MARSHALING_ERROR
An integer representation of
EVENT_MARSHALING_ERROR . |
static int |
REASON_EVENT_QUEUE_FULL
An integer representation of
EVENT_QUEUE_FULL . |
static int |
REASON_EVENT_QUEUE_TIMEOUT
An integer representation of
EVENT_QUEUE_TIMEOUT . |
static int |
REASON_FIRING_TRANSACTION_ROLLED_BACK
An integer representation of
FIRING_TRANSACTION_ROLLED_BACK . |
static int |
REASON_OTHER_REASON
An integer representation of
OTHER_REASON . |
static int |
REASON_SYSTEM_OVERLOAD
An integer representation of
SYSTEM_OVERLOAD . |
static FailureReason |
SYSTEM_OVERLOAD
Event failure reason indicating the event could not processed due to generic system
overload conditions.
|
Modifier | Constructor and Description |
---|---|
protected |
FailureReason(int reason)
Protected constructor that allows subclasses to extend this class with additional
vendor-defined reason codes, while preventing unauthorized object creation.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj)
Compare this failure reason for equality with another.
|
static FailureReason |
fromInt(int reason)
Get a
FailureReason object from an integer value. |
protected int |
getReason()
Get the reason code provided in the constructor.
|
int |
hashCode()
Get a hash code value for this failure reason error code.
|
boolean |
isEventMarshalingError()
Determine if this FailureReason object represents the EVENT MARSHALING ERROR reason.
|
boolean |
isEventQueueFull()
Determine if this FailureReason object represents the EVENT QUEUE FULL reason.
|
boolean |
isEventQueueTimeout()
Determine if this FailureReason object represents the EVENT QUEUE TIMEOUT reason.
|
boolean |
isFiringTransactionRolledBack()
Determine if this FailureReason object represents the FIRING TRANSACTION ROLLED BACK reason.
|
boolean |
isOtherReason()
Determine if this FailureReason object represents the OTHER REASON reason,
or represents a vendor-defined reason.
|
boolean |
isSystemOverLoad()
Determine if this FailureReason object represents the SYSTEM OVERLOAD reason.
|
int |
toInt()
Get an integer value representation for this
FailureReason object. |
String |
toString()
Get the textual representation of the FailureReason object.
|
public static final int REASON_OTHER_REASON
OTHER_REASON
.public static final int REASON_EVENT_QUEUE_FULL
EVENT_QUEUE_FULL
.public static final int REASON_EVENT_QUEUE_TIMEOUT
EVENT_QUEUE_TIMEOUT
.public static final int REASON_SYSTEM_OVERLOAD
SYSTEM_OVERLOAD
.public static final int REASON_EVENT_MARSHALING_ERROR
EVENT_MARSHALING_ERROR
.public static final int REASON_FIRING_TRANSACTION_ROLLED_BACK
FIRING_TRANSACTION_ROLLED_BACK
.public static final FailureReason OTHER_REASON
public static final FailureReason EVENT_QUEUE_FULL
public static final FailureReason EVENT_QUEUE_TIMEOUT
public static final FailureReason SYSTEM_OVERLOAD
public static final FailureReason EVENT_MARSHALING_ERROR
Marshaler
.public static final FailureReason FIRING_TRANSACTION_ROLLED_BACK
protected FailureReason(int reason)
reason
- the reason code.IllegalArgumentException
- if a vendor-defined reason code is less than or
equal to 0.public static FailureReason fromInt(int reason) throws IllegalArgumentException
FailureReason
object from an integer value.
This method returns the singleton objects for the failure reasons defined in
this class. For all vendor-defined reason codes (those greater than 0 in value),
a non-unique FailureReason
object is return encapsulating that value.
reason
- the reason as an integer.FailureReason
object corresponding to reason
.IllegalArgumentException
- if reason
is less that 0 and does not
correspond to a SLEE-defined reason code.public final int toInt()
FailureReason
object.FailureReason
object.public final boolean isOtherReason()
This method returns true
if the FailureReason
object
is equal to OTHER_REASON
, or if the reason code is a vendor-defined
reason code, ie. is greater that 0. This allows fallback to the generic reason
code if the consumer of the FailureReason
object is not familiar with
vendor-defined codes.
true
if this object represents the OTHER REASON reason,
or represents a vendor-defined reason code, false
otherwise.public final boolean isEventQueueFull()
This method is effectively equivalent to the conditional test:
(this == EVENT_QUEUE_FULL)
, ie. the code:
if (reason.isEventQueueFull()) ...
is interchangeable with the code:
if (reason == FailureReason.EVENT_QUEUE_FULL) ...
true
if this object represents the EVENT QUEUE FULL reason,
false
otherwise.public final boolean isEventQueueTimeout()
This method is effectively equivalent to the conditional test:
(this == EVENT_QUEUE_TIMEOUT)
, ie. the code:
if (reason.isEventQueueTimeout()) ...
is interchangeable with the code:
if (reason == FailureReason.EVENT_QUEUE_TIMEOUT) ...
true
if this object represents the EVENT QUEUE TIMEOUT reason,
false
otherwise.public final boolean isSystemOverLoad()
This method is effectively equivalent to the conditional test:
(this == SYSTEM_OVERLOAD)
, ie. the code:
if (reason.isSystemOverload()) ...
is interchangeable with the code:
if (reason == FailureReason.SYSTEM_OVERLOAD) ...
true
if this object represents the SYSTEM OVERLOAD reason,
false
otherwise.public final boolean isEventMarshalingError()
This method is effectively equivalent to the conditional test:
(this == EVENT_MARSHALING_ERROR)
, ie. the code:
if (reason.isEventMarshalingError()) ...
is interchangeable with the code:
if (reason == FailureReason.EVENT_MARSHALING_ERROR) ...
true
if this object represents the EVENT MARSHALING ERROR reason,
false
otherwise.public final boolean isFiringTransactionRolledBack()
This method is effectively equivalent to the conditional test:
(this == FIRING_TRANSACTION_ROLLED_BACK)
, ie. the code:
if (reason.isFiringTransactionRolledBack()) ...
is interchangeable with the code:
if (reason == FailureReason.FIRING_TRANSACTION_ROLLED_BACK) ...
true
if this object represents the FIRING TRANSACTION ROLLED BACK reason,
false
otherwise.public boolean equals(Object obj)
public final int hashCode()
public String toString()
protected final int getReason()
fromInt(int)
method and override the toString()
method
if desired.