org.opengroup.arm40.transaction
public interface ArmInterface
int
return value. If an error occurs in a factory method
(e.g., a method in ArmTransactionFactory
), the error code
is set in both the factory object and the newly created object. The
implementation of the object has sole discretion as to whether a method
results in an error.
The error code may change any time a method of the object is executed.
Executing a method overrides the previous error code value. The only
methods that will never change the error code are
getErrorCode()
and getErrorMessage()
.
If multiple threads are processing the same object simultaneously, the
results are unpredictable. An error code set as a result of an operation
in method X could be replaced by an operation in method Y before
thread X executes getErrorCode()
.
The error code can also be set with ArmInterface. This is a way
for the application to reset or change the error code. It would most
typically be used in a callback registered with the ARM implementation's
factory objects used to create ARM objects on behalf of the application.
In this way the application can implement a central error handling
policy in the callback. A value set with setErrorCode()
in a callback overwrites the previous value (i.e., the value that caused
the callback to be made).
For any non-zero error code returned by an object, the application can
request from the same object a string message describing the error
using ArmInterface. If the object does not support the
function or does not recognize the error code, it returns
null
.
Method Summary | |
---|---|
int | getErrorCode() |
String | getErrorMessage(int errorCode) |
int | setErrorCode(int errorCode) |
Returns: last error code set for this object as a negative value. Zero, if no error code is set.
Parameters: errorCode an error code retrieved from this object.
Returns: a string describing the error for errorCode
,
or null
.
Parameters: errorCode the error code to be set for this object.
Returns: the error code provided in errorCode
.