Class MappedSequentialFileFactory
- java.lang.Object
-
- org.apache.activemq.artemis.core.io.AbstractSequentialFileFactory
-
- org.apache.activemq.artemis.core.io.mapped.MappedSequentialFileFactory
-
- All Implemented Interfaces:
SequentialFileFactory
public final class MappedSequentialFileFactory extends AbstractSequentialFileFactory
-
-
Field Summary
-
Fields inherited from class org.apache.activemq.artemis.core.io.AbstractSequentialFileFactory
alignment, bufferSize, bufferTimeout, critialErrorListener, criticalAnalyzer, dataSync, EXECUTOR_TIMEOUT, journalDir, maxIO, timedBuffer, writeExecutor
-
-
Constructor Summary
Constructors Constructor Description MappedSequentialFileFactory(File directory, int capacity, boolean buffered, int bufferSize, int bufferTimeout, IOCriticalErrorListener criticalErrorListener)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description ByteBufferallocateDirectBuffer(int size)used for cases where you need direct buffer outside of the journal context.intcalculateBlockSize(int bytes)intcapacity()MappedSequentialFileFactorycapacity(int capacity)voidclearBuffer(ByteBuffer buffer)SequentialFilecreateSequentialFile(String fileName)SequentialFilecreateSequentialFile(String fileName, int capacity)MappedSequentialFileFactorydisableBufferReuse()MappedSequentialFileFactoryenableBufferReuse()intgetAlignment()booleanisSupportsCallbacks()ByteBuffernewBuffer(int size)Note: You need to release the buffer if is used for reading operations.ByteBuffernewBuffer(int size, boolean zeroed)Note: You need to release the buffer if is used for reading operations.voidreleaseBuffer(ByteBuffer buffer)voidreleaseDirectBuffer(ByteBuffer buffer)used for cases where you need direct buffer outside of the journal context.MappedSequentialFileFactorysetAlignment(int alignment)Deprecated.MappedSequentialFileFactorysetDatasync(boolean enabled)voidstart()voidstop()ByteBufferwrapBuffer(byte[] bytes)-
Methods inherited from class org.apache.activemq.artemis.core.io.AbstractSequentialFileFactory
activateBuffer, createDirs, deactivateBuffer, flush, getBufferSize, getCriticalAnalyzer, getCriticalErrorListener, getDirectory, getMaxIO, isDatasync, listFiles, onIOError, setCriticalErrorListener
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.activemq.artemis.core.io.SequentialFileFactory
onIOError, onIOError
-
-
-
-
Constructor Detail
-
MappedSequentialFileFactory
public MappedSequentialFileFactory(File directory, int capacity, boolean buffered, int bufferSize, int bufferTimeout, IOCriticalErrorListener criticalErrorListener)
-
-
Method Detail
-
capacity
public MappedSequentialFileFactory capacity(int capacity)
-
capacity
public int capacity()
-
createSequentialFile
public SequentialFile createSequentialFile(String fileName)
-
createSequentialFile
public SequentialFile createSequentialFile(String fileName, int capacity)
-
isSupportsCallbacks
public boolean isSupportsCallbacks()
-
allocateDirectBuffer
public ByteBuffer allocateDirectBuffer(int size)
Description copied from interface:SequentialFileFactoryused for cases where you need direct buffer outside of the journal context. This is because the native layer has a method that can be reused in certain cases like paging
-
releaseDirectBuffer
public void releaseDirectBuffer(ByteBuffer buffer)
Description copied from interface:SequentialFileFactoryused for cases where you need direct buffer outside of the journal context. This is because the native layer has a method that can be reused in certain cases like paging
-
enableBufferReuse
public MappedSequentialFileFactory enableBufferReuse()
-
disableBufferReuse
public MappedSequentialFileFactory disableBufferReuse()
-
newBuffer
public ByteBuffer newBuffer(int size)
Description copied from interface:SequentialFileFactoryNote: You need to release the buffer if is used for reading operations. You don't need to do it if using writing operations (AIO Buffer Lister will take of writing operations)- Returns:
- the allocated ByteBuffer
-
newBuffer
public ByteBuffer newBuffer(int size, boolean zeroed)
Description copied from interface:SequentialFileFactoryNote: You need to release the buffer if is used for reading operations. You don't need to do it if using writing operations (AIO Buffer Lister will take of writing operations)zeroed- iftruethe returnedByteBuffermust be zeroed, otherwise it tries to save zeroing it.- Returns:
- the allocated ByteBuffer
-
releaseBuffer
public void releaseBuffer(ByteBuffer buffer)
- Specified by:
releaseBufferin interfaceSequentialFileFactory- Overrides:
releaseBufferin classAbstractSequentialFileFactory
-
setDatasync
public MappedSequentialFileFactory setDatasync(boolean enabled)
- Specified by:
setDatasyncin interfaceSequentialFileFactory- Overrides:
setDatasyncin classAbstractSequentialFileFactory
-
wrapBuffer
public ByteBuffer wrapBuffer(byte[] bytes)
-
getAlignment
public int getAlignment()
- Specified by:
getAlignmentin interfaceSequentialFileFactory- Overrides:
getAlignmentin classAbstractSequentialFileFactory
-
setAlignment
@Deprecated public MappedSequentialFileFactory setAlignment(int alignment)
Deprecated.- Specified by:
setAlignmentin interfaceSequentialFileFactory- Overrides:
setAlignmentin classAbstractSequentialFileFactory
-
calculateBlockSize
public int calculateBlockSize(int bytes)
-
clearBuffer
public void clearBuffer(ByteBuffer buffer)
-
start
public void start()
- Specified by:
startin interfaceSequentialFileFactory- Overrides:
startin classAbstractSequentialFileFactory
-
stop
public void stop()
- Specified by:
stopin interfaceSequentialFileFactory- Overrides:
stopin classAbstractSequentialFileFactory
-
-