Class AbstractSequentialFile

    • Field Detail

      • file

        protected java.io.File file
      • directory

        protected final java.io.File directory
      • fileSize

        protected long fileSize
      • position

        protected final java.util.concurrent.atomic.AtomicLong position
      • timedBufferObserver

        protected final TimedBufferObserver timedBufferObserver
        Instead of having AIOSequentialFile implementing the Observer, I have done it on an inner class. This is the class returned to the factory when the file is being activated.
    • Constructor Detail

      • AbstractSequentialFile

        public AbstractSequentialFile​(java.io.File directory,
                                      java.lang.String file,
                                      SequentialFileFactory factory,
                                      java.util.concurrent.Executor writerExecutor)
        Parameters:
        file -
        directory -
    • Method Detail

      • delete

        public final void delete()
                          throws java.io.IOException,
                                 java.lang.InterruptedException,
                                 org.apache.activemq.artemis.api.core.ActiveMQException
        Specified by:
        delete in interface SequentialFile
        Throws:
        java.io.IOException
        java.lang.InterruptedException
        org.apache.activemq.artemis.api.core.ActiveMQException
      • position

        public void position​(long pos)
                      throws java.io.IOException
        Specified by:
        position in interface SequentialFile
        Throws:
        java.io.IOException - only declare exception due to signature. Sub-class needs it.
      • renameTo

        public final void renameTo​(java.lang.String newFileName)
                            throws java.io.IOException,
                                   java.lang.InterruptedException,
                                   org.apache.activemq.artemis.api.core.ActiveMQException
        Specified by:
        renameTo in interface SequentialFile
        Throws:
        java.io.IOException
        java.lang.InterruptedException
        org.apache.activemq.artemis.api.core.ActiveMQException
      • close

        public void close()
                   throws java.io.IOException,
                          java.lang.InterruptedException,
                          org.apache.activemq.artemis.api.core.ActiveMQException
        Specified by:
        close in interface SequentialFile
        Throws:
        java.io.IOException - we declare throwing IOException because sub-classes need to do it
        org.apache.activemq.artemis.api.core.ActiveMQException
        java.lang.InterruptedException
      • fits

        public final boolean fits​(int size)
        Specified by:
        fits in interface SequentialFile
      • write

        public void write​(org.apache.activemq.artemis.api.core.ActiveMQBuffer bytes,
                          boolean sync,
                          IOCallback callback)
                   throws java.io.IOException
        Specified by:
        write in interface SequentialFile
        Throws:
        java.io.IOException
      • write

        public void write​(org.apache.activemq.artemis.api.core.ActiveMQBuffer bytes,
                          boolean sync)
                   throws java.io.IOException,
                          java.lang.InterruptedException,
                          org.apache.activemq.artemis.api.core.ActiveMQException
        Specified by:
        write in interface SequentialFile
        Throws:
        java.io.IOException
        java.lang.InterruptedException
        org.apache.activemq.artemis.api.core.ActiveMQException
      • write

        public void write​(EncodingSupport bytes,
                          boolean sync)
                   throws java.lang.InterruptedException,
                          org.apache.activemq.artemis.api.core.ActiveMQException
        Specified by:
        write in interface SequentialFile
        Throws:
        java.lang.InterruptedException
        org.apache.activemq.artemis.api.core.ActiveMQException
      • getFile

        protected java.io.File getFile()
      • newBuffer

        protected java.nio.ByteBuffer newBuffer​(int requiredCapacity,
                                                boolean zeroed)
      • getJavaFile

        public java.io.File getJavaFile()
        Description copied from interface: SequentialFile
        Returns a native File of the file underlying this sequential file.
        Specified by:
        getJavaFile in interface SequentialFile