org.jboss.messaging.core.journal.impl
Class JournalCompactor

java.lang.Object
  extended by org.jboss.messaging.core.journal.impl.JournalCompactor
All Implemented Interfaces:
JournalReaderCallback

public class JournalCompactor
extends java.lang.Object
implements JournalReaderCallback

A JournalCompactor

Author:
Clebert Suconic

Constructor Summary
JournalCompactor(SequentialFileFactory fileFactory, JournalImpl journal, java.util.Set<java.lang.Long> recordsSnapshot, int firstFileID)
           
 
Method Summary
 void addCommandCommit(JournalTransaction liveTransaction, JournalFile currentFile)
           
 void addCommandDelete(long id, JournalFile usedFile)
           
 void addCommandRollback(JournalTransaction liveTransaction, JournalFile currentFile)
           
 void addCommandUpdate(long id, JournalFile usedFile, int size)
           
 void addPendingTransaction(long transactionID, long[] ids)
          This methods informs the Compactor about the existence of a pending (non committed) transaction
 void flush()
          Write pending output into file
 java.util.List<JournalFile> getNewDataFiles()
           
 java.util.Map<java.lang.Long,JournalImpl.JournalRecord> getNewRecords()
           
 java.util.Map<java.lang.Long,JournalTransaction> getNewTransactions()
           
 boolean lookupRecord(long id)
           
 void markAsDataFile(JournalFile file)
           
 void onReadAddRecord(RecordInfo info)
           
 void onReadAddRecordTX(long transactionID, RecordInfo info)
           
 void onReadCommitRecord(long transactionID, int numberOfRecords)
           
 void onReadDeleteRecord(long recordID)
           
 void onReadDeleteRecordTX(long transactionID, RecordInfo info)
           
 void onReadPrepareRecord(long transactionID, byte[] extraData, int numberOfRecords)
           
 void onReadRollbackRecord(long transactionID)
           
 void onReadUpdateRecord(RecordInfo info)
           
 void onReadUpdateRecordTX(long transactionID, RecordInfo info)
           
static SequentialFile readControlFile(SequentialFileFactory fileFactory, java.util.List<java.lang.String> dataFiles, java.util.List<java.lang.String> newFiles)
           
 void replayPendingCommands()
          Replay pending counts that happened during compacting
static SequentialFile writeControlFile(SequentialFileFactory fileFactory, java.util.List<JournalFile> files, java.util.List<JournalFile> newFiles)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JournalCompactor

public JournalCompactor(SequentialFileFactory fileFactory,
                        JournalImpl journal,
                        java.util.Set<java.lang.Long> recordsSnapshot,
                        int firstFileID)
Method Detail

writeControlFile

public static SequentialFile writeControlFile(SequentialFileFactory fileFactory,
                                              java.util.List<JournalFile> files,
                                              java.util.List<JournalFile> newFiles)
                                       throws java.lang.Exception
Parameters:
tmpRenameFile -
files -
newFiles -
Throws:
java.lang.Exception

readControlFile

public static SequentialFile readControlFile(SequentialFileFactory fileFactory,
                                             java.util.List<java.lang.String> dataFiles,
                                             java.util.List<java.lang.String> newFiles)
                                      throws java.lang.Exception
Throws:
java.lang.Exception

getNewDataFiles

public java.util.List<JournalFile> getNewDataFiles()

getNewRecords

public java.util.Map<java.lang.Long,JournalImpl.JournalRecord> getNewRecords()

getNewTransactions

public java.util.Map<java.lang.Long,JournalTransaction> getNewTransactions()

addPendingTransaction

public void addPendingTransaction(long transactionID,
                                  long[] ids)
This methods informs the Compactor about the existence of a pending (non committed) transaction


addCommandCommit

public void addCommandCommit(JournalTransaction liveTransaction,
                             JournalFile currentFile)
Parameters:
id -
journalTransaction -

addCommandRollback

public void addCommandRollback(JournalTransaction liveTransaction,
                               JournalFile currentFile)

addCommandDelete

public void addCommandDelete(long id,
                             JournalFile usedFile)
Parameters:
id -
usedFile -

addCommandUpdate

public void addCommandUpdate(long id,
                             JournalFile usedFile,
                             int size)
Parameters:
id -
usedFile -

lookupRecord

public boolean lookupRecord(long id)

flush

public void flush()
           throws java.lang.Exception
Write pending output into file

Throws:
java.lang.Exception

replayPendingCommands

public void replayPendingCommands()
Replay pending counts that happened during compacting


onReadAddRecord

public void onReadAddRecord(RecordInfo info)
                     throws java.lang.Exception
Specified by:
onReadAddRecord in interface JournalReaderCallback
Throws:
java.lang.Exception

onReadAddRecordTX

public void onReadAddRecordTX(long transactionID,
                              RecordInfo info)
                       throws java.lang.Exception
Specified by:
onReadAddRecordTX in interface JournalReaderCallback
Throws:
java.lang.Exception

onReadCommitRecord

public void onReadCommitRecord(long transactionID,
                               int numberOfRecords)
                        throws java.lang.Exception
Specified by:
onReadCommitRecord in interface JournalReaderCallback
Throws:
java.lang.Exception

onReadDeleteRecord

public void onReadDeleteRecord(long recordID)
                        throws java.lang.Exception
Specified by:
onReadDeleteRecord in interface JournalReaderCallback
Throws:
java.lang.Exception

onReadDeleteRecordTX

public void onReadDeleteRecordTX(long transactionID,
                                 RecordInfo info)
                          throws java.lang.Exception
Specified by:
onReadDeleteRecordTX in interface JournalReaderCallback
Throws:
java.lang.Exception

markAsDataFile

public void markAsDataFile(JournalFile file)
Specified by:
markAsDataFile in interface JournalReaderCallback

onReadPrepareRecord

public void onReadPrepareRecord(long transactionID,
                                byte[] extraData,
                                int numberOfRecords)
                         throws java.lang.Exception
Specified by:
onReadPrepareRecord in interface JournalReaderCallback
Throws:
java.lang.Exception

onReadRollbackRecord

public void onReadRollbackRecord(long transactionID)
                          throws java.lang.Exception
Specified by:
onReadRollbackRecord in interface JournalReaderCallback
Throws:
java.lang.Exception

onReadUpdateRecord

public void onReadUpdateRecord(RecordInfo info)
                        throws java.lang.Exception
Specified by:
onReadUpdateRecord in interface JournalReaderCallback
Throws:
java.lang.Exception

onReadUpdateRecordTX

public void onReadUpdateRecordTX(long transactionID,
                                 RecordInfo info)
                          throws java.lang.Exception
Specified by:
onReadUpdateRecordTX in interface JournalReaderCallback
Throws:
java.lang.Exception


Copyright © 2006 JBoss Inc. All Rights Reserved.