Class Journal
java.lang.Object
org.apache.activemq.store.kahadb.disk.journal.Journal
- Direct Known Subclasses:
ReadOnlyJournal
Manages DataFiles
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic enumstatic enumstatic enumstatic classstatic class -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected DataFileAccessorPoolprotected FileAppenderprotected booleanstatic final byte[]static final byte[]static final intstatic final bytestatic final Stringstatic final booleanprotected booleanprotected booleanprotected ScheduledFutureprotected LinkedNodeList<DataFile>static final Stringstatic final intstatic final Stringstatic final Stringstatic final Stringstatic final intstatic final intprotected Fileprotected Filestatic final byte[]protected booleanstatic final bytestatic final intstatic final byte[]protected Stringprotected Stringprotected final Map<Journal.WriteKey,Journal.WriteCommand> protected Journal.JournalDiskSyncStrategyprotected final AtomicReference<Location>protected intprotected Journal.PreallocationScopeprotected Journal.PreallocationStrategystatic final intprotected booleanprotected AtomicLongstatic final byteprotected int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidcleanup()voidclose()voidcorruptRecoveryLocation(Location recoveryPosition) booleandelete()longgetCurrentDataFile(int capacity) getDataFileById(int dataFileId) longgetFile(int nextNum) getFiles()Get a set of files - only valid after start()intgetNextLocation(Location location) getNextLocation(Location location, Location limit) intbooleanbooleanbooleanbooleanbooleanbooleanisUnusedPreallocated(DataFile dataFile) longlength()voidprotected LocationrecoveryCheck(DataFile dataFile) voidremoveDataFiles(Set<Integer> files) voidvoidsetArchiveDataLogs(boolean archiveDataLogs) voidsetCheckForCorruptionOnStartup(boolean checkForCorruptionOnStartup) voidsetChecksum(boolean checksumWrites) voidsetCleanupInterval(long cleanupInterval) voidsetDataFileRemovedListener(Journal.DataFileRemovedListener dataFileRemovedListener) voidsetDirectory(File directory) voidsetDirectoryArchive(File directoryArchive) voidsetEnableAsyncDiskSync(boolean val) voidsetFilePrefix(String filePrefix) voidsetFileSuffix(String fileSuffix) voidsetJournalDiskSyncStrategy(Journal.JournalDiskSyncStrategy journalDiskSyncStrategy) voidsetLastAppendLocation(Location lastSyncedLocation) voidsetMaxFileLength(int maxFileLength) voidsetPreallocationScope(Journal.PreallocationScope preallocationScope) voidsetPreallocationStrategy(Journal.PreallocationStrategy preallocationStrategy) voidsetReplicationTarget(ReplicationTarget replicationTarget) voidsetSizeAccumulator(AtomicLong storeSizeAccumulator) voidsetWriteBatchSize(int writeBatchSize) voidstart()toString()voidupdate(Location location, ByteSequence data, boolean sync) write(ByteSequence data, boolean sync) write(ByteSequence data, Runnable onComplete)
-
Field Details
-
CALLER_BUFFER_APPENDER
- See Also:
-
callerBufferAppender
public static final boolean callerBufferAppender -
RECORD_HEAD_SPACE
public static final int RECORD_HEAD_SPACE- See Also:
-
USER_RECORD_TYPE
public static final byte USER_RECORD_TYPE- See Also:
-
BATCH_CONTROL_RECORD_TYPE
public static final byte BATCH_CONTROL_RECORD_TYPE- See Also:
-
BATCH_CONTROL_RECORD_MAGIC
public static final byte[] BATCH_CONTROL_RECORD_MAGIC -
BATCH_CONTROL_RECORD_SIZE
public static final int BATCH_CONTROL_RECORD_SIZE -
BATCH_CONTROL_RECORD_HEADER
public static final byte[] BATCH_CONTROL_RECORD_HEADER -
EMPTY_BATCH_CONTROL_RECORD
public static final byte[] EMPTY_BATCH_CONTROL_RECORD -
EOF_INT
public static final int EOF_INT -
EOF_EOT
public static final byte EOF_EOT- See Also:
-
EOF_RECORD
public static final byte[] EOF_RECORD -
DEFAULT_DIRECTORY
- See Also:
-
DEFAULT_ARCHIVE_DIRECTORY
- See Also:
-
DEFAULT_FILE_PREFIX
- See Also:
-
DEFAULT_FILE_SUFFIX
- See Also:
-
DEFAULT_MAX_FILE_LENGTH
public static final int DEFAULT_MAX_FILE_LENGTH- See Also:
-
DEFAULT_CLEANUP_INTERVAL
public static final int DEFAULT_CLEANUP_INTERVAL- See Also:
-
DEFAULT_MAX_WRITE_BATCH_SIZE
public static final int DEFAULT_MAX_WRITE_BATCH_SIZE- See Also:
-
inflightWrites
-
directory
-
directoryArchive
-
filePrefix
-
fileSuffix
-
started
protected boolean started -
maxFileLength
protected int maxFileLength -
writeBatchSize
protected int writeBatchSize -
appender
-
accessorPool
-
fileMap
-
fileByFileMap
-
dataFiles
-
lastAppendLocation
-
cleanupTask
-
totalLength
-
archiveDataLogs
protected boolean archiveDataLogs -
checksum
protected boolean checksum -
checkForCorruptionOnStartup
protected boolean checkForCorruptionOnStartup -
enableAsyncDiskSync
protected boolean enableAsyncDiskSync -
preallocationScope
-
preallocationStrategy
-
journalDiskSyncStrategy
-
-
Constructor Details
-
Journal
public Journal()
-
-
Method Details
-
corruptRecoveryLocation
- Throws:
IOException
-
getAccessorPool
-
allowIOResumption
public void allowIOResumption() -
setCleanupInterval
public void setCleanupInterval(long cleanupInterval) -
getCleanupInterval
public long getCleanupInterval() -
start
- Throws:
IOException
-
preallocateEntireJournalDataFile
-
isUnusedPreallocated
- Throws:
IOException
-
recoveryCheck
- Throws:
IOException
-
length
public long length() -
rotateWriteFile
- Throws:
IOException
-
reserveDataFile
-
getFile
-
close
- Throws:
IOException
-
cleanup
public void cleanup() -
delete
- Throws:
IOException
-
removeDataFiles
- Throws:
IOException
-
getMaxFileLength
public int getMaxFileLength()- Returns:
- the maxFileLength
-
setMaxFileLength
public void setMaxFileLength(int maxFileLength) - Parameters:
maxFileLength- the maxFileLength to set
-
toString
-
getNextLocation
- Throws:
IOExceptionIllegalStateException
-
getNextLocation
public Location getNextLocation(Location location, Location limit) throws IOException, IllegalStateException - Throws:
IOExceptionIllegalStateException
-
read
- Throws:
IOExceptionIllegalStateException
-
write
- Throws:
IOExceptionIllegalStateException
-
write
public Location write(ByteSequence data, Runnable onComplete) throws IOException, IllegalStateException - Throws:
IOExceptionIllegalStateException
-
update
- Throws:
IOException
-
getPreallocationStrategy
-
setPreallocationStrategy
-
getPreallocationScope
-
setPreallocationScope
-
getDirectory
-
setDirectory
-
getFilePrefix
-
setFilePrefix
-
getInflightWrites
-
getLastAppendLocation
-
setLastAppendLocation
-
getDirectoryArchive
-
setDirectoryArchive
-
isArchiveDataLogs
public boolean isArchiveDataLogs() -
setArchiveDataLogs
public void setArchiveDataLogs(boolean archiveDataLogs) -
getDataFileById
-
getCurrentDataFile
- Throws:
IOException
-
getCurrentDataFileId
-
getFiles
Get a set of files - only valid after start()- Returns:
- files currently being used
-
getFileMap
-
getDiskSize
public long getDiskSize() -
setReplicationTarget
-
getReplicationTarget
-
getFileSuffix
-
setFileSuffix
-
isChecksum
public boolean isChecksum() -
setChecksum
public void setChecksum(boolean checksumWrites) -
isCheckForCorruptionOnStartup
public boolean isCheckForCorruptionOnStartup() -
setCheckForCorruptionOnStartup
public void setCheckForCorruptionOnStartup(boolean checkForCorruptionOnStartup) -
setWriteBatchSize
public void setWriteBatchSize(int writeBatchSize) -
getWriteBatchSize
public int getWriteBatchSize() -
setSizeAccumulator
-
setEnableAsyncDiskSync
public void setEnableAsyncDiskSync(boolean val) -
isEnableAsyncDiskSync
public boolean isEnableAsyncDiskSync() -
getJournalDiskSyncStrategy
-
setJournalDiskSyncStrategy
-
isJournalDiskSyncPeriodic
public boolean isJournalDiskSyncPeriodic() -
setDataFileRemovedListener
-