org.mule.util.journal
Class TransactionJournal<T,K extends JournalEntry<T>>

java.lang.Object
  extended by org.mule.util.journal.TransactionJournal<T,K>

public class TransactionJournal<T,K extends JournalEntry<T>>
extends Object

Keeps track of transactional operation made over a transactional resource. Uses two files for keeping track of the transactions and empties a file once all the entries in such file are resolved. Keeps a memory cache of the log entries for performance reasons. Once a transaction finishes the client of this class must manually remove the entries related to such transaction to clear the cache.


Constructor Summary
TransactionJournal(String logFilesDirectory, TransactionCompletePredicate transactionCompletePredicate, JournalEntrySerializer journalEntrySerializer)
           
 
Method Summary
 void clear()
          Removes all the entries from the transactionl jorunal
 void close()
          Release the resources used by the transaction journal
 com.google.common.collect.Multimap<T,K> getAllLogEntries()
           
 Collection<K> getLogEntriesForTx(T txId)
           
 void logCheckpointOperation(JournalEntry<T> journalEntry)
          Logs a checkpoint operation over the transactions.
 void logUpdateOperation(JournalEntry<T> journalEntry)
          Log an update operation over a transactional resource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransactionJournal

public TransactionJournal(String logFilesDirectory,
                          TransactionCompletePredicate transactionCompletePredicate,
                          JournalEntrySerializer journalEntrySerializer)
Parameters:
logFilesDirectory - directory used to store the journal files.
Method Detail

logUpdateOperation

public void logUpdateOperation(JournalEntry<T> journalEntry)
Log an update operation over a transactional resource

Parameters:
journalEntry - journal entry with the update operation details

logCheckpointOperation

public void logCheckpointOperation(JournalEntry<T> journalEntry)
Logs a checkpoint operation over the transactions. Most likely this is an operation such as COMMIT, ROLLBACK or PREPARE of a TX.

Parameters:
journalEntry - journal entry with the checkpoint operation details

getLogEntriesForTx

public Collection<K> getLogEntriesForTx(T txId)
Parameters:
txId - transaction identifier
Returns:
all the transaction entries for a certain transaction identifier

getAllLogEntries

public com.google.common.collect.Multimap<T,K> getAllLogEntries()
Returns:
all the transactional entries from the journal

close

public void close()
Release the resources used by the transaction journal


clear

public void clear()
Removes all the entries from the transactionl jorunal



Copyright © 2003–2014 MuleSoft, Inc.. All rights reserved.