Class AIOSequentialFileFactory
- java.lang.Object
-
- org.apache.activemq.artemis.core.io.AbstractSequentialFileFactory
-
- org.apache.activemq.artemis.core.io.aio.AIOSequentialFileFactory
-
- All Implemented Interfaces:
SequentialFileFactory
public final class AIOSequentialFileFactory extends AbstractSequentialFileFactory
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classAIOSequentialFileFactory.AIOSequentialCallbackThe same callback is used for Runnable executor.
-
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 AIOSequentialFileFactory(java.io.File journalDir, int maxIO)AIOSequentialFileFactory(java.io.File journalDir, int bufferSize, int bufferTimeout, int maxIO, boolean logRates)AIOSequentialFileFactory(java.io.File journalDir, int bufferSize, int bufferTimeout, int maxIO, boolean logRates, IOCriticalErrorListener listener, org.apache.activemq.artemis.utils.critical.CriticalAnalyzer analyzer)AIOSequentialFileFactory(java.io.File journalDir, IOCriticalErrorListener listener, int maxIO)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterClose()java.nio.ByteBufferallocateDirectBuffer(int size)used for cases where you need direct buffer outside of the journal context.voidbeforeClose()intcalculateBlockSize(int position)voidclearBuffer(java.nio.ByteBuffer directByteBuffer)SequentialFilecreateSequentialFile(java.lang.String fileName)voiddisableBufferReuse()voidenableBufferReuse()intgetAlignment()AIOSequentialFileFactory.AIOSequentialCallbackgetCallback()static booleanisSupported()static booleanisSupported(java.io.File journalPath)booleanisSupportsCallbacks()java.nio.ByteBuffernewBuffer(int size)Note: You need to release the buffer if is used for reading operations.java.nio.ByteBuffernewBuffer(int size, boolean zeroed)Note: You need to release the buffer if is used for reading operations.voidreleaseBuffer(java.nio.ByteBuffer buffer)voidreleaseDirectBuffer(java.nio.ByteBuffer buffer)used for cases where you need direct buffer outside of the journal context.voidstart()voidstop()java.lang.StringtoString()java.nio.ByteBufferwrapBuffer(byte[] bytes)-
Methods inherited from class org.apache.activemq.artemis.core.io.AbstractSequentialFileFactory
activateBuffer, createDirs, deactivateBuffer, flush, getBufferSize, getCriticalAnalyzer, getDirectory, getMaxIO, isDatasync, listFiles, onIOError, setAlignment, setDatasync
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.activemq.artemis.core.io.SequentialFileFactory
createSequentialFile
-
-
-
-
Constructor Detail
-
AIOSequentialFileFactory
public AIOSequentialFileFactory(java.io.File journalDir, int maxIO)
-
AIOSequentialFileFactory
public AIOSequentialFileFactory(java.io.File journalDir, IOCriticalErrorListener listener, int maxIO)
-
AIOSequentialFileFactory
public AIOSequentialFileFactory(java.io.File journalDir, int bufferSize, int bufferTimeout, int maxIO, boolean logRates)
-
AIOSequentialFileFactory
public AIOSequentialFileFactory(java.io.File journalDir, int bufferSize, int bufferTimeout, int maxIO, boolean logRates, IOCriticalErrorListener listener, org.apache.activemq.artemis.utils.critical.CriticalAnalyzer analyzer)
-
-
Method Detail
-
beforeClose
public void beforeClose()
-
afterClose
public void afterClose()
-
getCallback
public AIOSequentialFileFactory.AIOSequentialCallback getCallback()
-
enableBufferReuse
public void enableBufferReuse()
-
disableBufferReuse
public void disableBufferReuse()
-
createSequentialFile
public SequentialFile createSequentialFile(java.lang.String fileName)
-
isSupportsCallbacks
public boolean isSupportsCallbacks()
-
isSupported
public static boolean isSupported()
-
isSupported
public static boolean isSupported(java.io.File journalPath)
-
allocateDirectBuffer
public java.nio.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(java.nio.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
-
newBuffer
public java.nio.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 java.nio.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
-
clearBuffer
public void clearBuffer(java.nio.ByteBuffer directByteBuffer)
-
getAlignment
public int getAlignment()
- Specified by:
getAlignmentin interfaceSequentialFileFactory- Overrides:
getAlignmentin classAbstractSequentialFileFactory
-
wrapBuffer
public java.nio.ByteBuffer wrapBuffer(byte[] bytes)
-
calculateBlockSize
public int calculateBlockSize(int position)
-
releaseBuffer
public void releaseBuffer(java.nio.ByteBuffer buffer)
- Specified by:
releaseBufferin interfaceSequentialFileFactory- Overrides:
releaseBufferin classAbstractSequentialFileFactory
-
start
public void start()
- Specified by:
startin interfaceSequentialFileFactory- Overrides:
startin classAbstractSequentialFileFactory
-
stop
public void stop()
- Specified by:
stopin interfaceSequentialFileFactory- Overrides:
stopin classAbstractSequentialFileFactory
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-