Class FileEntryQueue

java.lang.Object
htmlpublisher.util.FileEntryQueue

public class FileEntryQueue extends Object
A queue that contains files When reading entries, the queue returns a file or waits until a file is added.
Also implements signaling the end of the queue with shutdown operations.
  • Constructor Details

    • FileEntryQueue

      public FileEntryQueue()
  • Method Details

    • getOrCreateQueue

      public static FileEntryQueue getOrCreateQueue(UUID queueKey)
      Get the queue specified by the key from the cache. If the key does not exist, a new queue will be created and added to the cache. The queue cache is located only on the local machine (agent or controller) and will not be remotely synchronized.
    • remove

      public static FileEntryQueue remove(UUID queueKey)
      Remove the queue specified by the key from the cache
      Returns:
      the removed queue or null, if queue was not in the cache before
    • add

      public FileEntryQueue.FileEntry add(File file, String relativePath)
      Inserts the specified file into this queue if it is possible to do so immediately without violating capacity restrictions
      Returns:
      the newly created file entry
      Throws:
      IllegalStateException - if no space is currently available
    • take

      Retrieves and removes the head of this queue, waiting if necessary until an element becomes available.
      Throws:
      InterruptedException - if the queue is closed
    • shutdown

      public void shutdown()
      Shutdown the queue, so no new work will be accepted but the existing work remains until processed
    • shutdownNow

      public void shutdownNow()
      All workers should stop there work as we want to stop as soon as possible - regardless if there is more to do or not
    • getOverallCount

      public int getOverallCount()
      Returns:
      the number of all added files since the creation of this queue
    • getOverallSize

      public long getOverallSize()
      Returns:
      the size of all added files since the creation of this queue
    • getStatistic

      public FileEntryQueue.Statistic getStatistic()
      Returns:
      some statistic about this queue