Class LogFileManager
java.lang.Object
org.apache.activeio.journal.active.LogFileManager
Provides a logical view of many separate files as one single long log file.
The separate files that compose the LogFile are Segments of the LogFile.
This class is not thread safe.
- Version:
- $Revision: 1.1 $
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final byte
static final int
static final int
static final byte
static final int
-
Constructor Summary
ConstructorsConstructorDescriptionLogFileManager
(File logDirectory) LogFileManager
(File logDirectory, int onlineLogFileCount, int initialLogFileSize, File archiveDirectory) -
Method Summary
Modifier and TypeMethodDescriptionvoid
append
(BatchedWrite write) boolean
void
dispose()
int
getNextDataRecordLocation
(Location lastLocation) int
boolean
readPacket
(Location location)
-
Field Details
-
DEFAULT_LOGFILE_COUNT
public static final int DEFAULT_LOGFILE_COUNT -
DEFAULT_LOGFILE_SIZE
public static final int DEFAULT_LOGFILE_SIZE -
SERIALIZED_SIZE
public static final int SERIALIZED_SIZE- See Also:
-
DATA_RECORD_TYPE
public static final byte DATA_RECORD_TYPE- See Also:
-
MARK_RECORD_TYPE
public static final byte MARK_RECORD_TYPE- See Also:
-
-
Constructor Details
-
LogFileManager
- Throws:
IOException
-
LogFileManager
public LogFileManager(File logDirectory, int onlineLogFileCount, int initialLogFileSize, File archiveDirectory) throws IOException - Throws:
IOException
-
-
Method Details
-
dispose
public void dispose() -
append
- Parameters:
write
-- Throws:
IOException
-
getNextDataRecordLocation
public Location getNextDataRecordLocation(Location lastLocation) throws IOException, InvalidRecordLocationException - Parameters:
lastLocation
-- Returns:
- Throws:
IOException
InvalidRecordLocationException
-
readPacket
- Parameters:
logFileIndex
-logFileOffset
-- Returns:
- Throws:
IOException
InvalidRecordLocationException
-
getInitialLogFileSize
public int getInitialLogFileSize() -
getFirstActiveLogLocation
-
getLogDirectory
- Returns:
- Returns the logDirectory.
-
getLastMarkedRecordLocation
- Returns:
- Returns the lastMark.
-
getNextAppendLocation
-
getOnlineLogFileCount
public int getOnlineLogFileCount()- Returns:
- Returns the onlineLogFileCount.
-
isPastHalfActive
public boolean isPastHalfActive() -
getFirstRecordLocationOfSecondActiveLogFile
-
canActivateNextLogFile
public boolean canActivateNextLogFile()
-