javax.slee.resource
Class FailureReason

java.lang.Object
  extended by javax.slee.resource.FailureReason

public class FailureReason
extends java.lang.Object

This class defines the standard reason error codes for event processing failures reported to resource adaptor objects by the 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.

Since:
SLEE 1.1

Field Summary
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.
 
Constructor Summary
protected FailureReason(int reason)
          Protected constructor that allows subclasses to extend this class with additional vendor-defined reason codes, while preventing unauthorized object creation.
 
Method Summary
 boolean equals(java.lang.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.
 java.lang.String toString()
          Get the textual representation of the FailureReason object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

REASON_OTHER_REASON

public static final int REASON_OTHER_REASON
An integer representation of OTHER_REASON.

See Also:
Constant Field Values

REASON_EVENT_QUEUE_FULL

public static final int REASON_EVENT_QUEUE_FULL
An integer representation of EVENT_QUEUE_FULL.

See Also:
Constant Field Values

REASON_EVENT_QUEUE_TIMEOUT

public static final int REASON_EVENT_QUEUE_TIMEOUT
An integer representation of EVENT_QUEUE_TIMEOUT.

See Also:
Constant Field Values

REASON_SYSTEM_OVERLOAD

public static final int REASON_SYSTEM_OVERLOAD
An integer representation of SYSTEM_OVERLOAD.

See Also:
Constant Field Values

REASON_EVENT_MARSHALING_ERROR

public static final int REASON_EVENT_MARSHALING_ERROR
An integer representation of EVENT_MARSHALING_ERROR.

See Also:
Constant Field Values

REASON_FIRING_TRANSACTION_ROLLED_BACK

public static final int REASON_FIRING_TRANSACTION_ROLLED_BACK
An integer representation of FIRING_TRANSACTION_ROLLED_BACK.

See Also:
Constant Field Values

OTHER_REASON

public static final FailureReason OTHER_REASON
Event failure reason indicating that the event could not be processed for an other reason.


EVENT_QUEUE_FULL

public static final FailureReason EVENT_QUEUE_FULL
Event failure reason indicating the event could not be enqueued for processing because the event queue is full.


EVENT_QUEUE_TIMEOUT

public static final 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. Typically this means the SLEE is overloaded.


SYSTEM_OVERLOAD

public static final FailureReason SYSTEM_OVERLOAD
Event failure reason indicating the event could not processed due to generic system overload conditions.


EVENT_MARSHALING_ERROR

public static final FailureReason EVENT_MARSHALING_ERROR
Event failure reason indicating the event could not be marshaled by the resource adaptor entity's Marshaler.


FIRING_TRANSACTION_ROLLED_BACK

public static final FailureReason FIRING_TRANSACTION_ROLLED_BACK
Event failure reason indicating the transaction in which the event was fired rolled back.

Constructor Detail

FailureReason

protected FailureReason(int reason)
Protected constructor that allows subclasses to extend this class with additional vendor-defined reason codes, while preventing unauthorized object creation.

Parameters:
reason - the reason code.
Throws:
java.lang.IllegalArgumentException - if a vendor-defined reason code is less than or equal to 0.
Method Detail

fromInt

public static FailureReason fromInt(int reason)
                             throws java.lang.IllegalArgumentException
Get a 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.

Parameters:
reason - the reason as an integer.
Returns:
a FailureReason object corresponding to reason.
Throws:
java.lang.IllegalArgumentException - if reason is less that 0 and does not correspond to a SLEE-defined reason code.

toInt

public final int toInt()
Get an integer value representation for this FailureReason object.

Returns:
an integer value representation for this FailureReason object.

isOtherReason

public final boolean isOtherReason()
Determine if this FailureReason object represents the OTHER REASON reason, or represents a vendor-defined reason.

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.

Returns:
true if this object represents the OTHER REASON reason, or represents a vendor-defined reason code, false otherwise.

isEventQueueFull

public final boolean isEventQueueFull()
Determine if this FailureReason object represents the EVENT QUEUE FULL reason.

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) ...

Returns:
true if this object represents the EVENT QUEUE FULL reason, false otherwise.

isEventQueueTimeout

public final boolean isEventQueueTimeout()
Determine if this FailureReason object represents the EVENT QUEUE TIMEOUT reason.

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) ...

Returns:
true if this object represents the EVENT QUEUE TIMEOUT reason, false otherwise.

isSystemOverLoad

public final boolean isSystemOverLoad()
Determine if this FailureReason object represents the SYSTEM OVERLOAD reason.

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) ...

Returns:
true if this object represents the SYSTEM OVERLOAD reason, false otherwise.

isEventMarshalingError

public final boolean isEventMarshalingError()
Determine if this FailureReason object represents the EVENT MARSHALING ERROR reason.

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) ...

Returns:
true if this object represents the EVENT MARSHALING ERROR reason, false otherwise.

isFiringTransactionRolledBack

public final boolean isFiringTransactionRolledBack()
Determine if this FailureReason object represents the FIRING TRANSACTION ROLLED BACK reason.

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) ...

Returns:
true if this object represents the FIRING TRANSACTION ROLLED BACK reason, false otherwise.

equals

public boolean equals(java.lang.Object obj)
Compare this failure reason for equality with another.

Overrides:
equals in class java.lang.Object
Parameters:
obj - the object to compare this with.
Returns:
true if obj is an instance of this class representing the same failure reason as this, false otherwise.

hashCode

public final int hashCode()
Get a hash code value for this failure reason error code.

Overrides:
hashCode in class java.lang.Object
Returns:
a hash code value.

toString

public java.lang.String toString()
Get the textual representation of the FailureReason object.

Overrides:
toString in class java.lang.Object
Returns:
the textual representation of the FailureReason object.

getReason

protected final int getReason()
Get the reason code provided in the constructor. This method allows subclasses to implement a fromInt(int) method and override the toString() method if desired.

Returns:
the reason code.


Copyright © 2008. All Rights Reserved.