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

java.lang.Object
  extended by org.jboss.messaging.core.journal.impl.JournalImpl
All Implemented Interfaces:
Journal, TestableJournal, MessagingComponent

public class JournalImpl
extends java.lang.Object
implements TestableJournal

A JournalImpl

Author:
Tim Fox, Clebert Suconic

Field Summary
static byte ADD_RECORD
           
static byte ADD_RECORD_TX
           
static byte COMMIT_RECORD
           
static byte DELETE_RECORD
           
static byte DELETE_RECORD_TX
           
static byte DONE
           
 java.lang.String fileExtension
           
 java.lang.String filePrefix
           
static byte FILL_CHARACTER
           
static int MIN_FILE_SIZE
           
static int MIN_TASK_PERIOD
           
static byte PREPARE_RECORD
           
static byte ROLLBACK_RECORD
           
static int SIZE_ADD_RECORD
           
static int SIZE_ADD_RECORD_TX
           
static byte SIZE_COMMIT_RECORD
           
static int SIZE_DELETE_RECORD
           
static int SIZE_DELETE_RECORD_TX
           
static int SIZE_HEADER
           
static int SIZE_PREPARE_RECORD
           
static byte SIZE_ROLLBACK_RECORD
           
static byte SIZE_UPDATE_RECORD
           
static int SIZE_UPDATE_RECORD_TX
           
static byte UPDATE_RECORD
           
static byte UPDATE_RECORD_TX
           
 
Constructor Summary
JournalImpl(int fileSize, int minFiles, boolean syncTransactional, boolean syncNonTransactional, SequentialFileFactory fileFactory, long taskPeriod, java.lang.String filePrefix, java.lang.String fileExtension, int maxAIO, long aioTimeout)
           
 
Method Summary
 void appendAddRecord(long id, byte recordType, byte[] record)
           
 void appendAddRecord(long id, byte recordType, EncodingSupport record)
           
 void appendAddRecordTransactional(long txID, byte recordType, long id, byte[] record)
           
 void appendAddRecordTransactional(long txID, byte recordType, long id, EncodingSupport record)
           
 void appendCommitRecord(long txID)
           
 void appendDeleteRecord(long id)
           
 void appendDeleteRecordTransactional(long txID, long id)
           
 void appendPrepareRecord(long txID)
           
 void appendRollbackRecord(long txID)
           
 void appendUpdateRecord(long id, byte recordType, byte[] record)
           
 void appendUpdateRecordTransactional(long txID, byte recordType, long id, byte[] record)
           
 void checkAndReclaimFiles()
           
 void checkReclaimStatus()
           
 java.lang.String debug()
           
 void debugWait()
          Method for use on testcases.
 int getAlignment()
           
 int getDataFilesCount()
           
 int getFreeFilesCount()
           
 int getIDMapSize()
           
 int getOpenedFilesCount()
           
 long getTransactionID()
           
 long load(java.util.List<RecordInfo> committedRecords, java.util.List<PreparedTransactionInfo> preparedTransactions)
           
 void start()
           
 void startReclaimer()
           
 void stop()
           
 void stopReclaimer()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MIN_FILE_SIZE

public static final int MIN_FILE_SIZE
See Also:
Constant Field Values

MIN_TASK_PERIOD

public static final int MIN_TASK_PERIOD
See Also:
Constant Field Values

SIZE_HEADER

public static final int SIZE_HEADER
See Also:
Constant Field Values

SIZE_ADD_RECORD

public static final int SIZE_ADD_RECORD
See Also:
Constant Field Values

ADD_RECORD

public static final byte ADD_RECORD
See Also:
Constant Field Values

SIZE_UPDATE_RECORD

public static final byte SIZE_UPDATE_RECORD
See Also:
Constant Field Values

UPDATE_RECORD

public static final byte UPDATE_RECORD
See Also:
Constant Field Values

SIZE_DELETE_RECORD

public static final int SIZE_DELETE_RECORD
See Also:
Constant Field Values

DELETE_RECORD

public static final byte DELETE_RECORD
See Also:
Constant Field Values

ADD_RECORD_TX

public static final byte ADD_RECORD_TX
See Also:
Constant Field Values

SIZE_ADD_RECORD_TX

public static final int SIZE_ADD_RECORD_TX
See Also:
Constant Field Values

SIZE_UPDATE_RECORD_TX

public static final int SIZE_UPDATE_RECORD_TX
See Also:
Constant Field Values

UPDATE_RECORD_TX

public static final byte UPDATE_RECORD_TX
See Also:
Constant Field Values

SIZE_DELETE_RECORD_TX

public static final int SIZE_DELETE_RECORD_TX
See Also:
Constant Field Values

DELETE_RECORD_TX

public static final byte DELETE_RECORD_TX
See Also:
Constant Field Values

SIZE_PREPARE_RECORD

public static final int SIZE_PREPARE_RECORD
See Also:
Constant Field Values

PREPARE_RECORD

public static final byte PREPARE_RECORD
See Also:
Constant Field Values

SIZE_COMMIT_RECORD

public static final byte SIZE_COMMIT_RECORD
See Also:
Constant Field Values

COMMIT_RECORD

public static final byte COMMIT_RECORD
See Also:
Constant Field Values

SIZE_ROLLBACK_RECORD

public static final byte SIZE_ROLLBACK_RECORD
See Also:
Constant Field Values

ROLLBACK_RECORD

public static final byte ROLLBACK_RECORD
See Also:
Constant Field Values

DONE

public static final byte DONE
See Also:
Constant Field Values

FILL_CHARACTER

public static final byte FILL_CHARACTER
See Also:
Constant Field Values

filePrefix

public final java.lang.String filePrefix

fileExtension

public final java.lang.String fileExtension
Constructor Detail

JournalImpl

public JournalImpl(int fileSize,
                   int minFiles,
                   boolean syncTransactional,
                   boolean syncNonTransactional,
                   SequentialFileFactory fileFactory,
                   long taskPeriod,
                   java.lang.String filePrefix,
                   java.lang.String fileExtension,
                   int maxAIO,
                   long aioTimeout)
Method Detail

appendAddRecord

public void appendAddRecord(long id,
                            byte recordType,
                            EncodingSupport record)
                     throws java.lang.Exception
Specified by:
appendAddRecord in interface Journal
Throws:
java.lang.Exception

appendAddRecord

public void appendAddRecord(long id,
                            byte recordType,
                            byte[] record)
                     throws java.lang.Exception
Specified by:
appendAddRecord in interface Journal
Throws:
java.lang.Exception

appendUpdateRecord

public void appendUpdateRecord(long id,
                               byte recordType,
                               byte[] record)
                        throws java.lang.Exception
Specified by:
appendUpdateRecord in interface Journal
Throws:
java.lang.Exception

appendDeleteRecord

public void appendDeleteRecord(long id)
                        throws java.lang.Exception
Specified by:
appendDeleteRecord in interface Journal
Throws:
java.lang.Exception

getTransactionID

public long getTransactionID()
Specified by:
getTransactionID in interface Journal

appendAddRecordTransactional

public void appendAddRecordTransactional(long txID,
                                         byte recordType,
                                         long id,
                                         EncodingSupport record)
                                  throws java.lang.Exception
Specified by:
appendAddRecordTransactional in interface Journal
Throws:
java.lang.Exception

appendAddRecordTransactional

public void appendAddRecordTransactional(long txID,
                                         byte recordType,
                                         long id,
                                         byte[] record)
                                  throws java.lang.Exception
Specified by:
appendAddRecordTransactional in interface Journal
Throws:
java.lang.Exception

appendUpdateRecordTransactional

public void appendUpdateRecordTransactional(long txID,
                                            byte recordType,
                                            long id,
                                            byte[] record)
                                     throws java.lang.Exception
Specified by:
appendUpdateRecordTransactional in interface Journal
Throws:
java.lang.Exception

appendDeleteRecordTransactional

public void appendDeleteRecordTransactional(long txID,
                                            long id)
                                     throws java.lang.Exception
Specified by:
appendDeleteRecordTransactional in interface Journal
Throws:
java.lang.Exception

appendPrepareRecord

public void appendPrepareRecord(long txID)
                         throws java.lang.Exception
Specified by:
appendPrepareRecord in interface Journal
Throws:
java.lang.Exception

appendCommitRecord

public void appendCommitRecord(long txID)
                        throws java.lang.Exception
Specified by:
appendCommitRecord in interface Journal
Throws:
java.lang.Exception

appendRollbackRecord

public void appendRollbackRecord(long txID)
                          throws java.lang.Exception
Specified by:
appendRollbackRecord in interface Journal
Throws:
java.lang.Exception

load

public long load(java.util.List<RecordInfo> committedRecords,
                 java.util.List<PreparedTransactionInfo> preparedTransactions)
          throws java.lang.Exception
Specified by:
load in interface Journal
Throws:
java.lang.Exception

getAlignment

public int getAlignment()
                 throws java.lang.Exception
Specified by:
getAlignment in interface Journal
Throws:
java.lang.Exception

checkReclaimStatus

public void checkReclaimStatus()
                        throws java.lang.Exception
Throws:
java.lang.Exception

debug

public java.lang.String debug()
                       throws java.lang.Exception
Specified by:
debug in interface TestableJournal
Throws:
java.lang.Exception

debugWait

public void debugWait()
               throws java.lang.Exception
Method for use on testcases. It will call waitComplete on every transaction, so any assertions on the file system will be correct after this

Specified by:
debugWait in interface TestableJournal
Throws:
java.lang.Exception

checkAndReclaimFiles

public void checkAndReclaimFiles()
                          throws java.lang.Exception
Specified by:
checkAndReclaimFiles in interface TestableJournal
Throws:
java.lang.Exception

getDataFilesCount

public int getDataFilesCount()
Specified by:
getDataFilesCount in interface TestableJournal

getFreeFilesCount

public int getFreeFilesCount()
Specified by:
getFreeFilesCount in interface TestableJournal

getOpenedFilesCount

public int getOpenedFilesCount()
Specified by:
getOpenedFilesCount in interface TestableJournal

getIDMapSize

public int getIDMapSize()
Specified by:
getIDMapSize in interface TestableJournal

start

public void start()
Specified by:
start in interface MessagingComponent

stop

public void stop()
          throws java.lang.Exception
Specified by:
stop in interface MessagingComponent
Throws:
java.lang.Exception

startReclaimer

public void startReclaimer()
Specified by:
startReclaimer in interface Journal

stopReclaimer

public void stopReclaimer()
Specified by:
stopReclaimer in interface Journal


Copyright © 2006 JBoss Inc. All Rights Reserved.