com.sun.sgs.impl.util
Class TransactionContextFactory.Participant

java.lang.Object
  extended by com.sun.sgs.impl.util.TransactionContextFactory.Participant
All Implemented Interfaces:
TransactionParticipant
Direct Known Subclasses:
TransactionContextFactory.NonDurableParticipant
Enclosing class:
TransactionContextFactory<T extends TransactionContext>

protected class TransactionContextFactory.Participant
extends Object
implements TransactionParticipant

Provides a durable transaction participant.


Constructor Summary
TransactionContextFactory.Participant()
          Creates an instance of this class.
 
Method Summary
 void abort(Transaction txn)
          Tells the participant to abort its involvement with the given transaction.
 void commit(Transaction 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(Transaction txn)
          Tells the participant to prepare for commiting its state associated with the given transaction.
 void prepareAndCommit(Transaction txn)
          Tells the participant to both prepare and commit its state associated with the given transaction.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransactionContextFactory.Participant

public TransactionContextFactory.Participant()
Creates an instance of this class.

Method Detail

prepare

public boolean prepare(Transaction 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.

Specified by:
prepare in interface TransactionParticipant
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

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

Specified by:
commit in interface TransactionParticipant
Parameters:
txn - the Transaction object

prepareAndCommit

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

Specified by:
prepareAndCommit in interface TransactionParticipant
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

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

Specified by:
abort in interface TransactionParticipant
Parameters:
txn - the Transaction object

getTypeName

public 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.

Specified by:
getTypeName in interface TransactionParticipant
Returns:
the name of the participant

RedDwarf, Version 0.10.1
2010-03-14 10:56:12

Copyright © 2010 The RedDwarf Authors. All rights reserved
Copyright © 2007-2010 Sun Microsystems, Inc. All rights reserved