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
Constructors Constructor Description JDBCSequentialFileFactory(JDBCConnectionProvider connectionProvider, SQLProvider sqlProvider, Executor executor, IOCriticalErrorListener criticalErrorListener)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactivateBuffer(SequentialFile file)ByteBufferallocateDirectBuffer(int size)used for cases where you need direct buffer outside of the journal context.intcalculateBlockSize(int bytes)voidclearBuffer(ByteBuffer buffer)voidcreateDirs()Creates the directory if it does not exist yet.SequentialFilecreateSequentialFile(String fileName)voiddeactivateBuffer()voiddestroy()voidflush()intgetAlignment()longgetBufferSize()JDBCSequentialFileFactoryDrivergetDbDriver()FilegetDirectory()intgetMaxIO()intgetNumberOfOpenFiles()booleanisDatasync()booleanisStarted()booleanisSupportsCallbacks()List<String>listFiles(String extension)Lists files that end with the given extension.ByteBuffernewBuffer(int size)Note: You need to release the buffer if is used for reading operations.voidonIOError(Exception exception, String message, SequentialFile file)The 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.voidsequentialFileClosed(SequentialFile file)JDBCSequentialFileFactorysetAlignment(int alignment)SequentialFileFactorysetDatasync(boolean enabled)voidstart()voidstop()ByteBufferwrapBuffer(byte[] bytes)-
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.server.ActiveMQComponent
asyncStop
-
Methods inherited from interface org.apache.activemq.artemis.core.io.SequentialFileFactory
createSequentialFile, getCriticalAnalyzer, newBuffer
-
-
-
-
Constructor Detail
-
JDBCSequentialFileFactory
public JDBCSequentialFileFactory(JDBCConnectionProvider connectionProvider, SQLProvider sqlProvider, Executor executor, IOCriticalErrorListener criticalErrorListener) throws Exception
- Throws:
Exception
-
-
Method Detail
-
getDbDriver
public JDBCSequentialFileFactoryDriver getDbDriver()
-
setDatasync
public SequentialFileFactory setDatasync(boolean enabled)
- 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
public SequentialFile createSequentialFile(String fileName)
- Specified by:
createSequentialFilein interfaceSequentialFileFactory
-
sequentialFileClosed
public void sequentialFileClosed(SequentialFile file)
-
getNumberOfOpenFiles
public int getNumberOfOpenFiles()
-
getMaxIO
public int getMaxIO()
- Specified by:
getMaxIOin interfaceSequentialFileFactory
-
listFiles
public List<String> listFiles(String extension) throws Exception
Description copied from interface:SequentialFileFactoryLists files that end with the given extension.This method inserts a ".' before the extension.
- Specified by:
listFilesin interfaceSequentialFileFactory- Returns:
- Throws:
Exception
-
isSupportsCallbacks
public boolean isSupportsCallbacks()
- Specified by:
isSupportsCallbacksin interfaceSequentialFileFactory
-
onIOError
public void onIOError(Exception exception, String message, SequentialFile file)
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
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- Specified by:
allocateDirectBufferin interfaceSequentialFileFactory
-
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- Specified by:
releaseDirectBufferin interfaceSequentialFileFactory
-
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)- Specified by:
newBufferin interfaceSequentialFileFactory- Returns:
- the allocated ByteBuffer
-
clearBuffer
public void clearBuffer(ByteBuffer buffer)
- Specified by:
clearBufferin interfaceSequentialFileFactory
-
wrapBuffer
public ByteBuffer wrapBuffer(byte[] bytes)
- Specified by:
wrapBufferin interfaceSequentialFileFactory
-
getAlignment
public int getAlignment()
- Specified by:
getAlignmentin interfaceSequentialFileFactory
-
setAlignment
public JDBCSequentialFileFactory setAlignment(int alignment)
- Specified by:
setAlignmentin interfaceSequentialFileFactory
-
calculateBlockSize
public int calculateBlockSize(int bytes)
- Specified by:
calculateBlockSizein interfaceSequentialFileFactory
-
deactivateBuffer
public void deactivateBuffer()
- Specified by:
deactivateBufferin interfaceSequentialFileFactory
-
releaseBuffer
public void releaseBuffer(ByteBuffer buffer)
- Specified by:
releaseBufferin interfaceSequentialFileFactory
-
activateBuffer
public void activateBuffer(SequentialFile file)
- Specified by:
activateBufferin interfaceSequentialFileFactory
-
getDirectory
public File getDirectory()
- Specified by:
getDirectoryin interfaceSequentialFileFactory
-
isStarted
public boolean isStarted()
- Specified by:
isStartedin interfaceActiveMQComponent
-
createDirs
public void createDirs() throws ExceptionDescription 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
public void destroy() throws SQLException- Throws:
SQLException
-
-