|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jcreme.sql.DefaultSQLExceptionHandler
This generic class enables to handle SQLExceptions. The class is able to handle differently Losses of Connection and Dead locks.
Field Summary | |
static java.lang.String |
SQL92_CONNECTION_ERROR_SQLSTATE_CLASS
As specified in SQL92. |
static java.lang.String |
SQL92_SERIALIZATION_FAILURE
As specified in SQL92. |
Fields inherited from interface org.jcreme.sql.SQLExceptionHandler |
EXCEPTION_TYPE_LOSS_OF_CONNECTION, EXCEPTION_TYPE_PLAIN_DEADLOCK, EXCEPTION_TYPE_ROLLEDBACK_DEADLOCK, EXCEPTION_TYPE_UNKNOWN, WAS_HANDLED |
Constructor Summary | |
DefaultSQLExceptionHandler()
|
Method Summary | |
int |
getDeadlockTimeout()
This method gives access to the number of milliseconds that the thread will wait for before making a new attempt to resolve a deadlock. |
int |
getNumberOfTries()
This method gives access to the number of attempts that will be done to resolve a deadlock (number of calls to the redo action). |
protected int |
handleConnectionClosed(CremeAction lossOfConnection)
This method enables to execute when the connection is closed. |
int |
handleException(java.sql.SQLException e)
This method handles an SQLException. |
int |
handleException(java.sql.SQLException e,
CremeAction rollback,
CremeAction lossOfConnection)
This method handles an SQLException. |
int |
handleException(java.sql.SQLException e,
CremeAction rollback,
CremeAction lossOfConnection,
CremeAction redo)
This method handles an SQLException. |
protected int |
handlePlainDeadLock(CremeAction redo)
This method enables to apply the redo action for numberOfTries times until it succeeds. |
protected int |
handleRolledBackDeadLock(CremeAction rollback)
This method enables to execute the rollback. |
boolean |
isDeadLock(java.sql.SQLException e)
This method can be used to test an SQLException. |
boolean |
isLossOfConnection(int i)
This method can be used to test a result returned by a handleException method call. |
boolean |
isLossOfConnection(java.sql.SQLException e)
This method can be used to test an SQLException. |
boolean |
isPlainDeadLock(int i)
This method can be used to test a result returned by a handleException method call. |
boolean |
isPlainDeadLock(java.sql.SQLException e)
This method can be used to test an SQLException. |
boolean |
isRolledBackDeadLock(int i)
This method can be used to test a result returned by a handleException method call. |
boolean |
isRolledBackDeadLock(java.sql.SQLException e)
This method can be used to test an SQLException. |
boolean |
isUnknown(int i)
This method can be used to test a result returned by a handleException method call. |
void |
setDeadlockTimeout(int timeout)
This method enables to change the number of milliseconds that the thread will wait for before making a new attempt to resolve a deadlock. |
void |
setNumberOfTries(int number)
This method enables to change the number of tries attempts that will be done to resolve a deadlock (number of calls to the redo action). |
boolean |
wasHandled(int i)
This method can be used to test a result returned by a handleException method call. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String SQL92_CONNECTION_ERROR_SQLSTATE_CLASS
public static final java.lang.String SQL92_SERIALIZATION_FAILURE
Constructor Detail |
public DefaultSQLExceptionHandler()
Method Detail |
public int handleException(java.sql.SQLException e)
handleException
in interface SQLExceptionHandler
e
- the exception to handle.
public int handleException(java.sql.SQLException e, CremeAction rollback, CremeAction lossOfConnection)
handleException
in interface SQLExceptionHandler
e
- the exception to handle.rollback
- the action to invoke to rollback.lossOfConnection
- the action to invoke in case of a loss of connection.
public int handleException(java.sql.SQLException e, CremeAction rollback, CremeAction lossOfConnection, CremeAction redo)
handleException
in interface SQLExceptionHandler
e
- the exception to handle.rollback
- the action to invoke to rollback.lossOfConnection
- the action to invoke in case of a loss of connection.redo
- the action to invoke in case of a simple deadlock.
protected int handleConnectionClosed(CremeAction lossOfConnection)
lossOfConnection
- the action to apply when the connection is closed.
protected int handleRolledBackDeadLock(CremeAction rollback)
rollback
- the action to apply when a rollback occured.
protected int handlePlainDeadLock(CremeAction redo)
redo
- the action to repeat.
public boolean isLossOfConnection(java.sql.SQLException e)
isLossOfConnection
in interface SQLExceptionHandler
e
- an SQLException to test.
public boolean isRolledBackDeadLock(java.sql.SQLException e)
isRolledBackDeadLock
in interface SQLExceptionHandler
e
- an SQLException to test.
public boolean isPlainDeadLock(java.sql.SQLException e)
isPlainDeadLock
in interface SQLExceptionHandler
e
- an SQLException to test.
public final boolean wasHandled(int i)
wasHandled
in interface SQLExceptionHandler
i
- an int produced by a handleException method call.
public final boolean isUnknown(int i)
isUnknown
in interface SQLExceptionHandler
i
- an int produced by a handleException method call.
public final boolean isLossOfConnection(int i)
isLossOfConnection
in interface SQLExceptionHandler
i
- an int produced by a handleException method call.
public final boolean isRolledBackDeadLock(int i)
isRolledBackDeadLock
in interface SQLExceptionHandler
i
- an int produced by a handleException method call.
public final boolean isPlainDeadLock(int i)
isPlainDeadLock
in interface SQLExceptionHandler
i
- an int produced by a handleException method call.
public final boolean isDeadLock(java.sql.SQLException e)
isDeadLock
in interface SQLExceptionHandler
e
- an SQLException to test.
public int getDeadlockTimeout()
getDeadlockTimeout
in interface SQLExceptionHandler
public int getNumberOfTries()
getNumberOfTries
in interface SQLExceptionHandler
public void setDeadlockTimeout(int timeout)
setDeadlockTimeout
in interface SQLExceptionHandler
timeout
- the number of milliseconds that the thread will wait for
before making a new attempt to resolve a deadlock.public void setNumberOfTries(int number)
setNumberOfTries
in interface SQLExceptionHandler
number
- the number of attempts that will be done
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |