public class Journal extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Journal.WriteCommand |
static class |
Journal.WriteKey |
| Constructor and Description |
|---|
Journal() |
public static final String CALLER_BUFFER_APPENDER
public static final boolean callerBufferAppender
public static final int RECORD_HEAD_SPACE
public static final byte USER_RECORD_TYPE
public static final byte BATCH_CONTROL_RECORD_TYPE
public static final byte[] BATCH_CONTROL_RECORD_MAGIC
public static final int BATCH_CONTROL_RECORD_SIZE
public static final byte[] BATCH_CONTROL_RECORD_HEADER
public static final String DEFAULT_DIRECTORY
public static final String DEFAULT_ARCHIVE_DIRECTORY
public static final String DEFAULT_FILE_PREFIX
public static final String DEFAULT_FILE_SUFFIX
public static final int DEFAULT_MAX_FILE_LENGTH
public static final int DEFAULT_CLEANUP_INTERVAL
public static final int PREFERED_DIFF
public static final int DEFAULT_MAX_WRITE_BATCH_SIZE
protected final Map<Journal.WriteKey,Journal.WriteCommand> inflightWrites
protected File directory
protected File directoryArchive
protected String filePrefix
protected String fileSuffix
protected boolean started
protected int maxFileLength
protected int preferedFileLength
protected int writeBatchSize
protected FileAppender appender
protected DataFileAccessorPool accessorPool
protected LinkedNodeList<DataFile> dataFiles
protected final AtomicReference<Location> lastAppendLocation
protected Runnable cleanupTask
protected AtomicLong totalLength
protected boolean archiveDataLogs
protected boolean checksum
protected boolean checkForCorruptionOnStartup
protected boolean enableAsyncDiskSync
public void start()
throws IOException
IOExceptionprotected Location recoveryCheck(DataFile dataFile) throws IOException
IOExceptionpublic int checkBatchRecord(org.apache.activemq.store.kahadb.disk.journal.DataFileAccessor reader, int offset) throws IOException
IOExceptionpublic long length()
public File getFile(int nextNum)
public void close()
throws IOException
IOExceptionprotected void cleanup()
public boolean delete()
throws IOException
IOExceptionpublic void removeDataFiles(Set<Integer> files) throws IOException
IOExceptionpublic int getMaxFileLength()
public void setMaxFileLength(int maxFileLength)
maxFileLength - the maxFileLength to setpublic void appendedExternally(Location loc, int length) throws IOException
IOExceptionpublic Location getNextLocation(Location location) throws IOException, IllegalStateException
IOExceptionIllegalStateExceptionpublic Location getNextLocation(File file, Location lastLocation, boolean thisFileOnly) throws IllegalStateException, IOException
IllegalStateExceptionIOExceptionpublic Location getNextLocation(DataFile dataFile, Location lastLocation, boolean thisFileOnly) throws IOException, IllegalStateException
IOExceptionIllegalStateExceptionpublic ByteSequence read(Location location) throws IOException, IllegalStateException
IOExceptionIllegalStateExceptionpublic Location write(ByteSequence data, boolean sync) throws IOException, IllegalStateException
IOExceptionIllegalStateExceptionpublic Location write(ByteSequence data, Runnable onComplete) throws IOException, IllegalStateException
IOExceptionIllegalStateExceptionpublic void update(Location location, ByteSequence data, boolean sync) throws IOException
IOExceptionpublic File getDirectory()
public void setDirectory(File directory)
public String getFilePrefix()
public void setFilePrefix(String filePrefix)
public Map<Journal.WriteKey,Journal.WriteCommand> getInflightWrites()
public Location getLastAppendLocation()
public void setLastAppendLocation(Location lastSyncedLocation)
public File getDirectoryArchive()
public void setDirectoryArchive(File directoryArchive)
public boolean isArchiveDataLogs()
public void setArchiveDataLogs(boolean archiveDataLogs)
public Integer getCurrentDataFileId()
public Set<File> getFiles()
public long getDiskSize()
public void setReplicationTarget(ReplicationTarget replicationTarget)
public ReplicationTarget getReplicationTarget()
public String getFileSuffix()
public void setFileSuffix(String fileSuffix)
public boolean isChecksum()
public void setChecksum(boolean checksumWrites)
public boolean isCheckForCorruptionOnStartup()
public void setCheckForCorruptionOnStartup(boolean checkForCorruptionOnStartup)
public void setWriteBatchSize(int writeBatchSize)
public int getWriteBatchSize()
public void setSizeAccumulator(AtomicLong storeSizeAccumulator)
public void setEnableAsyncDiskSync(boolean val)
public boolean isEnableAsyncDiskSync()
Copyright © 2005-2014 The Apache Software Foundation. All Rights Reserved.