Framework Professional Edition Package


org.mbs.services.transaction
Class TransactionException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by org.mbs.services.transaction.TransactionException
All Implemented Interfaces:
java.io.Serializable

public class TransactionException
extends java.lang.Exception

TransactionException exception is thrown when the transaction has been marked for rollback only or the transaction has been rolled back instead of committed. This is a local exception thrown by methods in the Transaction interface.

Author:
Valentin Valchev
See Also:
Serialized Form

Field Summary
static int HEURISTICS_COMMIT_ERROR
          A transaction resource has failed during the 2nd, commit phase, of the commit process.
static int HEURISTICS_ROLLBACK_ERROR
          A transaction resource has failed during rollback.
static int RESOURCE_ERROR
          A transaction resource has failed during the 1st, prepare phase of the commit process.
static int STATE_ERROR
          This error code is assigned, when the Transaction.commit() method is invoked and Transaction is not in active state, or was marked as rollback only.
static int THREADS_NOT_FINISHED_ERROR
          This error code is assigned, when the Transaction.commit() method is invoked and Transaction is assigned to more than one thread.
static int TIMEOUT_ERROR
          A transaction cannot be committed because it has expired.
static int UNDEFINED
          Undefined error code
 
Constructor Summary
TransactionException()
          Creates new transaction exception
TransactionException(int errorCode)
          Creates a new transaction exception with the specified error code.
TransactionException(java.lang.String message)
          Creates new transaction exception, with specified error message
TransactionException(java.lang.String message, java.lang.Throwable nested)
          Creates new transaction exception, with specified error message and nested cause
TransactionException(java.lang.String message, java.lang.Throwable nested, int errorCode)
          Creates new transaction exception, with specified error message and nested cause.
 
Method Summary
 int getErrorCode()
          Used to obtain the error code
 java.lang.Throwable getNestedException()
          Used to obtain the nested exception
 void printStackTrace(java.io.PrintStream out)
           
 void printStackTrace(java.io.PrintWriter out)
           
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UNDEFINED

public static final int UNDEFINED
Undefined error code

See Also:
Constant Field Values

THREADS_NOT_FINISHED_ERROR

public static final int THREADS_NOT_FINISHED_ERROR
This error code is assigned, when the Transaction.commit() method is invoked and Transaction is assigned to more than one thread.

See Also:
Constant Field Values

STATE_ERROR

public static final int STATE_ERROR
This error code is assigned, when the Transaction.commit() method is invoked and Transaction is not in active state, or was marked as rollback only. In this case, the application may check TransactionContext.getStatus() method.

See Also:
Constant Field Values

RESOURCE_ERROR

public static final int RESOURCE_ERROR
A transaction resource has failed during the 1st, prepare phase of the commit process.

See Also:
TransactionResource.prepare(TransactionContext), Constant Field Values

HEURISTICS_COMMIT_ERROR

public static final int HEURISTICS_COMMIT_ERROR
A transaction resource has failed during the 2nd, commit phase, of the commit process. This is typically a RuntimeException TransactionResource#commit(TransactionContext)

See Also:
Constant Field Values

HEURISTICS_ROLLBACK_ERROR

public static final int HEURISTICS_ROLLBACK_ERROR
A transaction resource has failed during rollback. This is typically a RuntimeException

See Also:
TransactionResource.rollback(TransactionContext), Constant Field Values

TIMEOUT_ERROR

public static final int TIMEOUT_ERROR
A transaction cannot be committed because it has expired.

See Also:
Constant Field Values
Constructor Detail

TransactionException

public TransactionException()
Creates new transaction exception


TransactionException

public TransactionException(int errorCode)
Creates a new transaction exception with the specified error code.

Parameters:
errorCode - the error code

TransactionException

public TransactionException(java.lang.String message)
Creates new transaction exception, with specified error message

Parameters:
message - description of the error

TransactionException

public TransactionException(java.lang.String message,
                            java.lang.Throwable nested)
Creates new transaction exception, with specified error message and nested cause

Parameters:
message - description of the error
nested - the nested cause

TransactionException

public TransactionException(java.lang.String message,
                            java.lang.Throwable nested,
                            int errorCode)
Creates new transaction exception, with specified error message and nested cause. Also assigns an error code.

Parameters:
message - description of the error
nested - the nested cause
errorCode - the error code
Method Detail

getNestedException

public java.lang.Throwable getNestedException()
Used to obtain the nested exception

Returns:
the nested exception

getErrorCode

public int getErrorCode()
Used to obtain the error code

Returns:
the error code

printStackTrace

public void printStackTrace(java.io.PrintStream out)
Overrides:
printStackTrace in class java.lang.Throwable
See Also:
Throwable.printStackTrace(java.io.PrintStream)

printStackTrace

public void printStackTrace(java.io.PrintWriter out)
Overrides:
printStackTrace in class java.lang.Throwable
See Also:
Throwable.printStackTrace(java.io.PrintWriter)

Framework Professional Edition Package


Copyright © 1999-2007 ProSyst Software GmbH. All Rights Reserved