Class BlockBasedDataStore
- java.lang.Object
-
- net.timewalker.ffmq4.storage.data.impl.AbstractDataStore
-
- net.timewalker.ffmq4.storage.data.impl.AbstractBlockBasedDataStore
-
- net.timewalker.ffmq4.storage.data.impl.BlockBasedDataStore
-
- All Implemented Interfaces:
DataStore,LinkedDataStore
public final class BlockBasedDataStore extends AbstractBlockBasedDataStore
BlockBasedDataStore
-
-
Field Summary
-
Fields inherited from class net.timewalker.ffmq4.storage.data.impl.AbstractBlockBasedDataStore
AB_ALLOCSIZE_OFFSET, AB_FLAGS_OFFSET, AB_NEXTBLOCK_OFFSET, AB_PREVBLOCK_OFFSET, allocatedSize, ALLOCATION_TABLE_SUFFIX, allocationTableFile, allocationTableRandomAccessFile, AT_BLOCK_SIZE, AT_HEADER_BLOCKCOUNT_OFFSET, AT_HEADER_FIRSTBLOCK_OFFSET, AT_HEADER_SIZE, blockCount, blockSize, DATA_FILE_SUFFIX, dataFile, dataRandomAccessFile, descriptor, firstBlock, flags, nextBlock, previousBlock
-
Fields inherited from class net.timewalker.ffmq4.storage.data.impl.AbstractDataStore
locks, SAFE_MODE
-
-
Constructor Summary
Constructors Constructor Description BlockBasedDataStore(QueueDefinition queueDef)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcommitChanges()Ensure everything's persisted (synchronous)voidcommitChanges(SynchronizationBarrier barrier)Ensure everything's persisted (asynchronous)protected voidextendStoreFiles(int oldBlockCount, int newBlockCount)Extend the store files to newBlockCountprotected voidflush()Flush internal buffersprotected voidinitFilesystem()protected voidreadDataBlock(byte[] data, int offset, int len, int blockHandle)Read a data block to diskprotected voidwriteAllocationBlock(int blockIndex)Write an allocation block to diskprotected voidwriteDataBlock(byte[] data, int offset, int len, int blockHandle)Write a data block to diskprotected voidwriteFirstBlock()Write the first block index to disk-
Methods inherited from class net.timewalker.ffmq4.storage.data.impl.AbstractBlockBasedDataStore
checkHandle, close, delete, first, getAbsoluteStoreUsage, getBlockSize, getStoreUsage, init, integrityCheck, next, previous, replace, retrieve, retrieveHeader, serializeAllocationBlock, size, store, toString
-
Methods inherited from class net.timewalker.ffmq4.storage.data.impl.AbstractDataStore
isLocked, lock, unlock
-
-
-
-
Constructor Detail
-
BlockBasedDataStore
public BlockBasedDataStore(QueueDefinition queueDef)
Constructor
-
-
Method Detail
-
initFilesystem
protected void initFilesystem() throws DataStoreException- Overrides:
initFilesystemin classAbstractBlockBasedDataStore- Throws:
DataStoreException
-
writeFirstBlock
protected void writeFirstBlock() throws DataStoreExceptionDescription copied from class:AbstractBlockBasedDataStoreWrite the first block index to disk- Specified by:
writeFirstBlockin classAbstractBlockBasedDataStore- Throws:
DataStoreException
-
writeAllocationBlock
protected void writeAllocationBlock(int blockIndex) throws DataStoreExceptionDescription copied from class:AbstractBlockBasedDataStoreWrite an allocation block to disk- Specified by:
writeAllocationBlockin classAbstractBlockBasedDataStore- Throws:
DataStoreException
-
writeDataBlock
protected void writeDataBlock(byte[] data, int offset, int len, int blockHandle) throws DataStoreExceptionDescription copied from class:AbstractBlockBasedDataStoreWrite a data block to disk- Specified by:
writeDataBlockin classAbstractBlockBasedDataStore- Throws:
DataStoreException
-
readDataBlock
protected void readDataBlock(byte[] data, int offset, int len, int blockHandle) throws DataStoreExceptionDescription copied from class:AbstractBlockBasedDataStoreRead a data block to disk- Specified by:
readDataBlockin classAbstractBlockBasedDataStore- Throws:
DataStoreException
-
extendStoreFiles
protected void extendStoreFiles(int oldBlockCount, int newBlockCount) throws DataStoreExceptionDescription copied from class:AbstractBlockBasedDataStoreExtend the store files to newBlockCount- Specified by:
extendStoreFilesin classAbstractBlockBasedDataStore- Throws:
DataStoreException
-
commitChanges
public void commitChanges() throws DataStoreExceptionDescription copied from interface:DataStoreEnsure everything's persisted (synchronous)- Throws:
DataStoreException
-
commitChanges
public void commitChanges(SynchronizationBarrier barrier) throws DataStoreException
Description copied from interface:DataStoreEnsure everything's persisted (asynchronous)- Throws:
DataStoreException
-
flush
protected void flush() throws DataStoreExceptionDescription copied from class:AbstractBlockBasedDataStoreFlush internal buffers- Specified by:
flushin classAbstractBlockBasedDataStore- Throws:
DataStoreException
-
-