Interface TaskQueue<T extends DataSubmissionTask<T>>

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void add​(T entry)
      Add a task to the end of the queue
      void clear()
      Empty and re-initialize the queue.
      void close()
      Close the queue.
      Long getAvailableBytes()
      Returns the total number of pre-allocated but unused bytes in the backing file.
      T peek()
      Retrieve a task that is currently at the head of the queue.
      void remove()
      Remove a task from the head of the queue.
      int size()
      Returns a number of tasks currently in the queue.
      Long weight()
      Returns the total weight of the queue (sum of weights of all tasks).
    • Method Detail

      • peek

        @Nullable
        T peek()
        Retrieve a task that is currently at the head of the queue.
        Returns:
        task object
      • add

        void add​(@Nonnull
                 T entry)
          throws IOException
        Add a task to the end of the queue
        Parameters:
        entry - task
        Throws:
        IOException - IO exceptions caught by the storage engine
      • remove

        void remove()
             throws IOException
        Remove a task from the head of the queue. Requires peek() to be called first, otherwise an IllegalStateException is thrown.
        Throws:
        IOException - IO exceptions caught by the storage engine
      • size

        int size()
        Returns a number of tasks currently in the queue.
        Returns:
        number of tasks
      • close

        void close()
            throws IOException
        Close the queue. Should be invoked before a graceful shutdown.
        Throws:
        IOException
      • weight

        @Nullable
        Long weight()
        Returns the total weight of the queue (sum of weights of all tasks).
        Returns:
        weight of the queue (null if unknown)
      • getAvailableBytes

        @Nullable
        Long getAvailableBytes()
        Returns the total number of pre-allocated but unused bytes in the backing file. May return null if not applicable.
        Returns:
        total number of available bytes in the file or null