|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface TransactionService
General interface for a Transaction managing service. This service is used by Transaction Interceptors and is not intended to use directly by application code.
Method Summary | |
---|---|
void |
addTransactionEventListener(TransactionEventListener listener)
Adds a new listener to the list of TransactionEventListener s
notified by this TransactionService upon transaction. |
void |
begin(TransactionDemarcation demarcation)
Marks the beginning of a new transaction demarcation scope. |
void |
end()
Marks the end of a transaction demarcation scope. |
java.lang.Object |
getCurrentTransaction()
Get the current "transaction" context for the calling thread. |
void |
removeTransactionEventListener(TransactionEventListener listener)
Removes a listener from the list of TransactionEventListener s
notified by this TransactionService upon transaction. |
void |
setRollbackOnly()
Marks the current transaction to be rolled back when it will end. |
Method Detail |
---|
void begin(TransactionDemarcation demarcation) throws TransactionException, MandatoryTransactionException, ForbiddenTransactionException
demarcation
, the service may create a new transaction,
throw an exception, or do nothing at all.
demarcation
- transaction for the new beginning scope
MandatoryTransactionException
- if there is no current
transaction and demarcation == Mandatory
ForbiddenTransactionException
- in a transaction currently
exists and demarcation == Never
TransactionException
- in case of any problem preventing the
creation of a new transaction (implementation-dependent)void end() throws TransactionException
demarcation
for this scope, the service may
end the current transaction, throw an exception, or do nothing at all.
The current transaction, if necessary, will be either committed or
rolled back, depending on whether setRollbackOnly
was called
previously for this transaction.
In addition, the method might activate a previously active transaction.
If there is no current transaction, this is not considered an error but an indication of scope-leaving, which lets the possibility of scope unfolding, in order to set the new current transaction context.
TransactionException
- in case of any problem preventing the
commitment of the current transaction (implementation-dependent)void setRollbackOnly() throws MandatoryTransactionException
If there is no current transaction, calling this method is considered an error.
MandatoryTransactionException
- in case there is no transaction
in the current call context.java.lang.Object getCurrentTransaction()
This method is for internal use (eg, by services proxying actual connections).
null
if there is no transaction in the current context. Note
that if there is a transaction in the current context, this object
cannot be null
, hence the method can be used to
check if there is a pending transaction for the current context.void addTransactionEventListener(TransactionEventListener listener)
TransactionEventListener
s
notified by this TransactionService
upon transaction.
listener
- the listener to add to the listvoid removeTransactionEventListener(TransactionEventListener listener)
TransactionEventListener
s
notified by this TransactionService
upon transaction.
listener
- the listener to remove from the list
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |