Class JDBCSequentialFileFactory
java.lang.Object
org.apache.activemq.artemis.jdbc.store.file.JDBCSequentialFileFactory
- All Implemented Interfaces:
SequentialFileFactory,ActiveMQComponent
public class JDBCSequentialFileFactory
extends Object
implements SequentialFileFactory, ActiveMQComponent
-
Constructor Summary
ConstructorsConstructorDescriptionJDBCSequentialFileFactory(JDBCConnectionProvider connectionProvider, SQLProvider sqlProvider, Executor executor, ScheduledExecutorService scheduledExecutorService, long syncDelay, IOCriticalErrorListener criticalErrorListener) -
Method Summary
Modifier and TypeMethodDescriptionvoidactivateBuffer(SequentialFile file) allocateDirectBuffer(int size) used for cases where you need direct buffer outside of the journal context.intcalculateBlockSize(int bytes) voidclearBuffer(ByteBuffer buffer) voidCreates the directory if it does not exist yet.createSequentialFile(String fileName) voidvoiddestroy()voidflush()intlongintgetMaxIO()intbooleanbooleanbooleanLists files that end with the given extension.newBuffer(int size) Note: You need to release the buffer if is used for reading operations.voidThe SequentialFile will call this method when a disk IO Error happens during the live phase.voidreleaseBuffer(ByteBuffer buffer) voidreleaseDirectBuffer(ByteBuffer buffer) used for cases where you need direct buffer outside of the journal context.voidsetAlignment(int alignment) setDatasync(boolean enabled) voidstart()voidstop()booleanOnly JDBC supports individual context.wrapBuffer(byte[] bytes) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.activemq.artemis.core.server.ActiveMQComponent
asyncStopMethods inherited from interface org.apache.activemq.artemis.core.io.SequentialFileFactory
createSequentialFile, getCriticalAnalyzer, getCriticalErrorListener, isSyncSupported, newBuffer, onIOError, onIOError, setCriticalErrorListener
-
Constructor Details
-
JDBCSequentialFileFactory
public JDBCSequentialFileFactory(JDBCConnectionProvider connectionProvider, SQLProvider sqlProvider, Executor executor, ScheduledExecutorService scheduledExecutorService, long syncDelay, IOCriticalErrorListener criticalErrorListener) throws Exception - Throws:
Exception
-
-
Method Details
-
supportsIndividualContext
public boolean supportsIndividualContext()Description copied from interface:SequentialFileFactoryOnly JDBC supports individual context. Meaning for Files we need to use the Sync scheduler. for JDBC we need to use a callback from the JDBC completion thread to complete the IOContexts.- Specified by:
supportsIndividualContextin interfaceSequentialFileFactory
-
getDbDriver
-
setDatasync
- Specified by:
setDatasyncin interfaceSequentialFileFactory
-
isDatasync
public boolean isDatasync()- Specified by:
isDatasyncin interfaceSequentialFileFactory
-
getBufferSize
public long getBufferSize()- Specified by:
getBufferSizein interfaceSequentialFileFactory
-
start
public void start()- Specified by:
startin interfaceActiveMQComponent- Specified by:
startin interfaceSequentialFileFactory
-
stop
public void stop()- Specified by:
stopin interfaceActiveMQComponent- Specified by:
stopin interfaceSequentialFileFactory
-
createSequentialFile
- Specified by:
createSequentialFilein interfaceSequentialFileFactory
-
sequentialFileClosed
-
getNumberOfOpenFiles
public int getNumberOfOpenFiles() -
getMaxIO
public int getMaxIO()- Specified by:
getMaxIOin interfaceSequentialFileFactory
-
listFiles
Description copied from interface:SequentialFileFactoryLists files that end with the given extension.This method inserts a ".' before the extension.
- Specified by:
listFilesin interfaceSequentialFileFactory- Throws:
Exception
-
isSupportsCallbacks
public boolean isSupportsCallbacks()- Specified by:
isSupportsCallbacksin interfaceSequentialFileFactory
-
onIOError
Description copied from interface:SequentialFileFactoryThe SequentialFile will call this method when a disk IO Error happens during the live phase.- Specified by:
onIOErrorin interfaceSequentialFileFactory
-
allocateDirectBuffer
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- Specified by:
allocateDirectBufferin interfaceSequentialFileFactory
-
releaseDirectBuffer
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- Specified by:
releaseDirectBufferin interfaceSequentialFileFactory
-
newBuffer
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)- Specified by:
newBufferin interfaceSequentialFileFactory- Returns:
- the allocated ByteBuffer
-
clearBuffer
- Specified by:
clearBufferin interfaceSequentialFileFactory
-
wrapBuffer
- Specified by:
wrapBufferin interfaceSequentialFileFactory
-
getAlignment
public int getAlignment()- Specified by:
getAlignmentin interfaceSequentialFileFactory
-
setAlignment
- Specified by:
setAlignmentin interfaceSequentialFileFactory
-
calculateBlockSize
public int calculateBlockSize(int bytes) - Specified by:
calculateBlockSizein interfaceSequentialFileFactory
-
deactivateBuffer
public void deactivateBuffer()- Specified by:
deactivateBufferin interfaceSequentialFileFactory
-
releaseBuffer
- Specified by:
releaseBufferin interfaceSequentialFileFactory
-
activateBuffer
- Specified by:
activateBufferin interfaceSequentialFileFactory
-
getDirectory
- Specified by:
getDirectoryin interfaceSequentialFileFactory
-
getDirectoryName
- Specified by:
getDirectoryNamein interfaceSequentialFileFactory
-
isStarted
public boolean isStarted()- Specified by:
isStartedin interfaceActiveMQComponent
-
createDirs
Description copied from interface:SequentialFileFactoryCreates the directory if it does not exist yet.- Specified by:
createDirsin interfaceSequentialFileFactory- Throws:
Exception
-
flush
public void flush()- Specified by:
flushin interfaceSequentialFileFactory
-
destroy
- Throws:
SQLException
-