Class DefaultWorkQueue<T>
java.lang.Object
io.micronaut.kubernetes.client.openapi.operator.workqueue.DefaultWorkQueue<T>
- Type Parameters:
T- item type
- All Implemented Interfaces:
WorkQueue<T>
- Direct Known Subclasses:
DefaultDelayingQueue
The default
WorkQueue implementation that uses a doubly-linked list to store work items.
This class ensures the added work items are not in dirty set nor in currently processing set before
adding them to the list.
The code has been copied from the official client and modified: DefaultWorkQueue
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds an item to the queue of items which need processing.voidMarks an item as completed.get()Gets an item for processing.booleanReturns whether the queue is shutdown.intlength()Returns the current queue length, for informational purposes only.voidshutdown()Initiates a shutdown of the work queue.voidstart()Starts the work queue.
-
Constructor Details
-
DefaultWorkQueue
public DefaultWorkQueue()
-
-
Method Details
-
add
Description copied from interface:WorkQueueAdds an item to the queue of items which need processing. -
length
public int length()Description copied from interface:WorkQueueReturns the current queue length, for informational purposes only. -
get
Description copied from interface:WorkQueueGets an item for processing. It blocks until there is an available item.- Specified by:
getin interfaceWorkQueue<T>- Returns:
- the item
- Throws:
InterruptedException
-
done
Description copied from interface:WorkQueueMarks an item as completed. Also, it will add the same item back to the queue of items which need processing if the item was marked as dirty while processing was in progress. -
start
public void start()Description copied from interface:WorkQueueStarts the work queue. Can be called after shutdown to enable queue usage. -
shutdown
public void shutdown()Description copied from interface:WorkQueueInitiates a shutdown of the work queue. All added items whose processing not started will be ignored and removed from the queue. -
isShutdown
public boolean isShutdown()Description copied from interface:WorkQueueReturns whether the queue is shutdown.- Specified by:
isShutdownin interfaceWorkQueue<T>- Returns:
trueif the queue is shutdown
-