org.ehcache.transactions.xa.journal
Interface Journal<K>

All Known Implementing Classes:
PersistentJournal, TransientJournal

public interface Journal<K>

XA transactions journal used to record the state of in-flight transactions.


Method Summary
 void close()
          Close the journal.
 void forget(TransactionId transactionId)
          Forget a transaction that was terminated upon a heuristic decision.
 java.util.Collection<K> getInDoubtKeys(TransactionId transactionId)
          Get a Collection of keys modified by a transaction still in-doubt.
 java.util.Map<TransactionId,java.lang.Boolean> heuristicDecisions()
          Recover the state of all transactions that were terminated upon a heuristic decision.
 boolean isHeuristicallyTerminated(TransactionId transactionId)
          Check if a transaction has been terminated by a heuristic decision.
 boolean isInDoubt(TransactionId transactionId)
          Check if a transaction has been saved as in-doubt.
 void open()
          Open the journal.
 java.util.Map<TransactionId,java.util.Collection<K>> recover()
          Recover the state of all in-doubt transactions.
 void saveCommitted(TransactionId transactionId, boolean heuristicDecision)
          Save that a transaction has committed.
 void saveInDoubt(TransactionId transactionId, java.util.Collection<K> inDoubtKeys)
          Save that a transaction is in-doubt.
 void saveRolledBack(TransactionId transactionId, boolean heuristicDecision)
          Save that a transaction has rolled back.
 

Method Detail

saveCommitted

void saveCommitted(TransactionId transactionId,
                   boolean heuristicDecision)
Save that a transaction has committed.

Parameters:
transactionId - the ID of the transaction.
heuristicDecision - true if the state change is being done upon a heuristic decision.

saveRolledBack

void saveRolledBack(TransactionId transactionId,
                    boolean heuristicDecision)
Save that a transaction has rolled back.

Parameters:
transactionId - the ID of the transaction.
heuristicDecision - true if the state change is being done upon a heuristic decision.

saveInDoubt

void saveInDoubt(TransactionId transactionId,
                 java.util.Collection<K> inDoubtKeys)
Save that a transaction is in-doubt.

Parameters:
transactionId - the ID of the transaction.
inDoubtKeys - a Collection of keys modified by the transaction.

isInDoubt

boolean isInDoubt(TransactionId transactionId)
Check if a transaction has been saved as in-doubt.

Parameters:
transactionId - the ID of the transaction.
Returns:
true if the transaction is in-doubt.

getInDoubtKeys

java.util.Collection<K> getInDoubtKeys(TransactionId transactionId)
Get a Collection of keys modified by a transaction still in-doubt.

Parameters:
transactionId - the ID of the transaction.
Returns:
a Collection of keys modified by the transaction.

recover

java.util.Map<TransactionId,java.util.Collection<K>> recover()
Recover the state of all in-doubt transactions.

Returns:
a map using the transaction ID as the key and the state as value.

isHeuristicallyTerminated

boolean isHeuristicallyTerminated(TransactionId transactionId)
Check if a transaction has been terminated by a heuristic decision.

Parameters:
transactionId - the ID of the transaction.
Returns:
true if the transaction has been terminated by a heuristic decision.

heuristicDecisions

java.util.Map<TransactionId,java.lang.Boolean> heuristicDecisions()
Recover the state of all transactions that were terminated upon a heuristic decision.

Returns:
a map using the transaction ID as the key and the value true if the state is committed, false if it is rolled back.

forget

void forget(TransactionId transactionId)
Forget a transaction that was terminated upon a heuristic decision.

Parameters:
transactionId - the Id of the transaction.

open

void open()
          throws java.io.IOException
Open the journal.

Throws:
java.io.IOException - if there was an error opening the journal.

close

void close()
           throws java.io.IOException
Close the journal.

Throws:
java.io.IOException - if there was an error closing the journal.