|
Side of Software Persistence Library 2.0 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface TransactionPolicy
A policy that determines the behavior of database transactions. Specifically, a class that implements this interface is in charge of
AbstractTransactionPolicy
,
DefaultTransactionPolicy
,
DefaultReadWriteTransactionPolicy
Method Summary | |
---|---|
java.lang.Object |
invoke(TransactionSupport support,
java.lang.reflect.Method method,
java.lang.Object[] args)
Invokes the specified method on the object referred to by support . |
void |
registerObject(TransactionSupport support,
java.lang.Object object)
Notifies this policy that there is a new database object. |
void |
startTransaction(TransactionSupport support)
Notifies this policy that a top-level transaction is starting for the executing thread. |
void |
unregisterObjects(Database db,
java.util.Set<java.lang.Object> oldKeys)
Notifies this policy that objects have been removed from the database. |
Method Detail |
---|
java.lang.Object invoke(TransactionSupport support, java.lang.reflect.Method method, java.lang.Object[] args) throws java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException, java.io.IOException
support
.
The database calls this method to invoke a method on a database object.
If the object can potentially be modified by the execution of method
,
the implementation should fetch the receiver using getObjectForWrite
;
otherwise, it should use getObjectForRead
.
If the object needs to be locked during the execution of method
,
the implementation can use the object returned by getKey
to identify the lock.
If this method throws a DatabaseException
, the current transaction
will be aborted and rolled back.
support
- object to assist in transaction managementmethod
- method to invoke on the object referred to by support
args
- arguments to the method
method
java.lang.IllegalAccessException
- if method is not accessible
java.lang.reflect.InvocationTargetException
- if the invocation of method
throws an exception. The exception returned by getCause
is the method's exception.
java.io.IOException
- if an I/O error occursTransactionSupport.getKey()
,
TransactionSupport.getObjectForRead()
,
TransactionSupport.getObjectForWrite()
void registerObject(TransactionSupport support, java.lang.Object object) throws java.io.IOException
support
- object to assist in transaction managementobject
- the object added to the database
java.io.IOException
- if an I/O error occursvoid startTransaction(TransactionSupport support) throws java.io.IOException
support
- object to assist in transaction management
java.io.IOException
- if an I/O error occursvoid unregisterObjects(Database db, java.util.Set<java.lang.Object> oldKeys)
db
- database for which the objects have been removedoldKeys
- set of objects that identify the objects being removed
from the database
|
Side of Software Persistence Library 2.0 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |