Package htmlpublisher.util
Class FileEntryQueue
java.lang.Object
htmlpublisher.util.FileEntryQueue
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.
Also implements signaling the end of the queue with shutdown operations.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
An entry in a queuestatic class
Some statistical data about the queue -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionInserts the specified file into this queue if it is possible to do so immediately without violating capacity restrictionsstatic FileEntryQueue
getOrCreateQueue
(UUID queueKey) Get the queue specified by the key from the cache.int
long
static FileEntryQueue
Remove the queue specified by the key from the cachevoid
shutdown()
Shutdown the queue, so no new work will be accepted but the existing work remains until processedvoid
All workers should stop there work as we want to stop as soon as possible - regardless if there is more to do or nottake()
Retrieves and removes the head of this queue, waiting if necessary until an element becomes available.
-
Constructor Details
-
FileEntryQueue
public FileEntryQueue()
-
-
Method Details
-
getOrCreateQueue
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
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
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
- Returns:
- some statistic about this queue
-