org.codehaus.activemq.journal.impl
Class LogFile

java.lang.Object
  extended byorg.codehaus.activemq.journal.impl.LogFile

public final class LogFile
extends Object

Provides a logical view of many seperate files as one single long log file. The seperate files that compose the LogFile are Segements of the LogFile.

This class is not thread safe.

Version:
$Revision: 1.7 $

Nested Class Summary
static class LogFile.RecordInfo
           
 
Field Summary
static byte DATA_RECORD_TYPE
           
static byte MARK_RECORD_TYPE
           
 
Constructor Summary
LogFile(File logDirectory)
           
LogFile(File logDirectory, int onlineSegmentCount, int initialSegmentSize)
           
 
Method Summary
(package private)  void activateNextSegment()
           
 void appendAndForce(BatchedWrite write)
           
 boolean canActivateNextSegment()
           
 void close()
           
 byte getAppendSegmentIndex()
           
 int getAppendSegmentOffset()
           
 byte getFirstActiveSegmentIndex()
           
 RecordLocationImpl getFirstRecordLocationOfSecondActiveSegment(byte fm)
           
 long getFirstSequenceIdOfSegementIndex(byte i)
           
 int getInitialSegmentSize()
           
 RecordLocationImpl getLastMarkedRecordLocation(byte fm)
           
 long getLastSequenceId()
           
 File getLogDirectory()
           
 RecordLocationImpl getNextDataRecordLocation(RecordLocationImpl lastLocation)
           
(package private)  int getTotalSegements()
           
 boolean isSegmentIndexActive(byte i)
           
 byte[] readData(int segmentIndex, int segmentOffset)
           
 RecordLocationImpl readRecordLocation(RecordLocationImpl location)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DATA_RECORD_TYPE

public static final byte DATA_RECORD_TYPE
See Also:
Constant Field Values

MARK_RECORD_TYPE

public static final byte MARK_RECORD_TYPE
See Also:
Constant Field Values
Constructor Detail

LogFile

public LogFile(File logDirectory)
        throws IOException

LogFile

public LogFile(File logDirectory,
               int onlineSegmentCount,
               int initialSegmentSize)
        throws IOException
Method Detail

close

public void close()
           throws IOException
Throws:
IOException

appendAndForce

public void appendAndForce(BatchedWrite write)
                    throws IOException
Parameters:
write -
Throws:
IOException

readRecordLocation

public RecordLocationImpl readRecordLocation(RecordLocationImpl location)
                                      throws IOException,
                                             InvalidRecordLocationException
Parameters:
location -
Returns:
Throws:
InvalidRecordLocationException
IOException

getNextDataRecordLocation

public RecordLocationImpl getNextDataRecordLocation(RecordLocationImpl lastLocation)
                                             throws IOException,
                                                    InvalidRecordLocationException
Parameters:
lastLocation -
Returns:
Throws:
IOException
InvalidRecordLocationException

readData

public byte[] readData(int segmentIndex,
                       int segmentOffset)
                throws IOException
Parameters:
segmentIndex -
segmentOffset -
Returns:
Throws:
IOException

getInitialSegmentSize

public int getInitialSegmentSize()

isSegmentIndexActive

public boolean isSegmentIndexActive(byte i)

getFirstSequenceIdOfSegementIndex

public long getFirstSequenceIdOfSegementIndex(byte i)

canActivateNextSegment

public boolean canActivateNextSegment()

getFirstActiveSegmentIndex

public byte getFirstActiveSegmentIndex()

activateNextSegment

void activateNextSegment()
                   throws IOException
Throws:
IOException

getAppendSegmentIndex

public byte getAppendSegmentIndex()
Returns:

getAppendSegmentOffset

public int getAppendSegmentOffset()
Returns:

getTotalSegements

int getTotalSegements()

getLastSequenceId

public long getLastSequenceId()

getFirstRecordLocationOfSecondActiveSegment

public RecordLocationImpl getFirstRecordLocationOfSecondActiveSegment(byte fm)
Returns:

getLogDirectory

public File getLogDirectory()
Returns:
Returns the logDirectory.

getLastMarkedRecordLocation

public RecordLocationImpl getLastMarkedRecordLocation(byte fm)
Returns:
Returns the lastMark.


Copyright © 2004 Protique, Ltd.. All Rights Reserved.