com.pentagaia.tb.tx
Interface ITransactionParticipant


public interface ITransactionParticipant

A participant to join transactions

Since:
0.1.0
Version:
0.1.0
Author:
mepeisen

Method Summary
 void abort(ITransaction txn)
          Tells the participant to abort its involvement with the given transaction.
 void commit(ITransaction txn)
          Tells the participant to commit its state associated with the given transaction.
 String getTypeName()
          Returns the fully qualified type name of the participant.
 boolean prepare(ITransaction txn)
          Tells the participant to prepare for commiting its state associated with the given transaction.
 void prepareAndCommit(ITransaction txn)
          Tells the participant to both prepare and commit its state associated with the given transaction.
 

Method Detail

prepare

boolean prepare(ITransaction txn)
                throws Exception
Tells the participant to prepare for commiting its state associated with the given transaction. This method returns a boolean flag stating whether the prepared state is read-only, meaning that no external state is modified by this participant. If this method returns true, then neither commit nor abort will be called.

If this method throws an exception, then the preparation failed, and the transaction will be aborted. If this method completes successfully, then the participant is required to be able to commit the transaction without failure.

Parameters:
txn - the Transaction object
Returns:
true if this participant is read-only, false otherwise
Throws:
Exception - if there are any failures in preparing
IllegalStateException - if this participant has already been prepared, committed, or aborted, or if this participant is not participating in the given transaction

commit

void commit(ITransaction txn)
Tells the participant to commit its state associated with the given transaction.

Parameters:
txn - the Transaction object
Throws:
IllegalStateException - if this participant was not previously prepared, or if this participant has already committed or aborted, or if this participant is not participating in the given transaction

prepareAndCommit

void prepareAndCommit(ITransaction txn)
                      throws Exception
Tells the participant to both prepare and commit its state associated with the given transaction.

Parameters:
txn - the Transaction object
Throws:
Exception - if there are any failures in preparing
IllegalStateException - if this participant has already been prepared, committed, or aborted, or if this participant is not participating in the given transaction

abort

void abort(ITransaction txn)
Tells the participant to abort its involvement with the given transaction.

Parameters:
txn - the Transaction object
Throws:
IllegalStateException - if this participant has already been aborted or committed, or if this participant is not participating in the given transaction

getTypeName

String getTypeName()
Returns the fully qualified type name of the participant. If this participant is acting as a proxy for a Service, this will typically be the Service's type name.

Returns:
the name of the participant


Copyright © 2008. All Rights Reserved.