Interface SequentialFileFactory

All Known Implementing Classes:
AbstractSequentialFileFactory, AIOSequentialFileFactory, MappedSequentialFileFactory, NIOSequentialFileFactory

public interface SequentialFileFactory
A SequentialFileFactory
  • Method Details

    • getCriticalErrorListener

      default IOCriticalErrorListener getCriticalErrorListener()
    • setCriticalErrorListener

      default void setCriticalErrorListener(IOCriticalErrorListener listener)
    • getCriticalAnalyzer

      default org.apache.activemq.artemis.utils.critical.CriticalAnalyzer getCriticalAnalyzer()
    • createSequentialFile

      SequentialFile createSequentialFile(String fileName)
    • createSequentialFile

      default SequentialFile createSequentialFile(String fileName, int capacity)
    • getMaxIO

      int getMaxIO()
    • isSyncSupported

      default boolean isSyncSupported()
    • listFiles

      List<String> listFiles(String extension) throws Exception
      Lists files that end with the given extension.

      This method inserts a ".' before the extension.

      Throws:
      Exception
    • isSupportsCallbacks

      boolean isSupportsCallbacks()
    • onIOError

      void onIOError(Throwable exception, String message, String file)
      The SequentialFile will call this method when a disk IO Error happens during the live phase.
    • onIOError

      default void onIOError(Throwable exception, String message, SequentialFile file)
    • onIOError

      default void onIOError(Throwable exception, String message)
    • allocateDirectBuffer

      ByteBuffer allocateDirectBuffer(int size)
      used 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

      void releaseDirectBuffer(ByteBuffer buffer)
      used 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

      ByteBuffer newBuffer(int size)
      Note: 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

      default ByteBuffer newBuffer(int size, boolean zeroed)
      Note: 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)
      Parameters:
      zeroed - if true the returned ByteBuffer must be zeroed, otherwise it tries to save zeroing it.
      Returns:
      the allocated ByteBuffer
    • releaseBuffer

      void releaseBuffer(ByteBuffer buffer)
    • activateBuffer

      void activateBuffer(SequentialFile file)
    • deactivateBuffer

      void deactivateBuffer()
    • wrapBuffer

      ByteBuffer wrapBuffer(byte[] bytes)
    • getAlignment

      int getAlignment()
    • setAlignment

      SequentialFileFactory setAlignment(int alignment)
    • calculateBlockSize

      int calculateBlockSize(int bytes)
    • getDirectory

      File getDirectory()
    • getDirectoryName

      default String getDirectoryName()
    • clearBuffer

      void clearBuffer(ByteBuffer buffer)
    • start

      void start()
    • stop

      void stop()
    • createDirs

      void createDirs() throws Exception
      Creates the directory if it does not exist yet.
      Throws:
      Exception
    • flush

      void flush()
    • setDatasync

      SequentialFileFactory setDatasync(boolean enabled)
    • isDatasync

      boolean isDatasync()
    • getBufferSize

      long getBufferSize()
    • supportsIndividualContext

      default boolean supportsIndividualContext()
      Only 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.