Class DefaultRateLimitingQueue<T>
java.lang.Object
io.micronaut.kubernetes.client.openapi.operator.workqueue.DefaultWorkQueue<T>
io.micronaut.kubernetes.client.openapi.operator.workqueue.DefaultDelayingQueue<T>
io.micronaut.kubernetes.client.openapi.operator.workqueue.DefaultRateLimitingQueue<T>
- Type Parameters:
T
- item type
- All Implemented Interfaces:
DelayingQueue<T>
,RateLimitingQueue<T>
,WorkQueue<T>
public class DefaultRateLimitingQueue<T>
extends DefaultDelayingQueue<T>
implements RateLimitingQueue<T>
The default rate limiting queue implementation.
The code has been copied from the official client and modified: DefaultRateLimitingQueue
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultRateLimitingQueue
(ExecutorService waitingWorker) DefaultRateLimitingQueue
(ExecutorService waitingWorker, RateLimiter<T> rateLimiter) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addRateLimited
(T item) Adds an item to the work queue after the rate limiter says it is ok.void
Indicates that an item is finished being retried.int
numRequeues
(T item) Returns back how many times the item was requeued.void
shutdown()
Initiates a shutdown of the work queue.Methods inherited from class io.micronaut.kubernetes.client.openapi.operator.workqueue.DefaultDelayingQueue
addAfter, start
Methods inherited from class io.micronaut.kubernetes.client.openapi.operator.workqueue.DefaultWorkQueue
add, done, get, isShutdown, length
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.micronaut.kubernetes.client.openapi.operator.workqueue.DelayingQueue
addAfter
-
Constructor Details
-
DefaultRateLimitingQueue
-
DefaultRateLimitingQueue
-
-
Method Details
-
numRequeues
Description copied from interface:RateLimitingQueue
Returns back how many times the item was requeued.- Specified by:
numRequeues
in interfaceRateLimitingQueue<T>
- Parameters:
item
- specific item- Returns:
- number of times the item was requeued
-
forget
Description copied from interface:RateLimitingQueue
Indicates that an item is finished being retried. Doesn't matter whether it is for perm failing or for success, we'll stop the rate limiter from tracking it. This only clears the `rateLimiter`, you still have to call `Done` on the queue.- Specified by:
forget
in interfaceRateLimitingQueue<T>
- Parameters:
item
- item which is finished being retried
-
addRateLimited
Description copied from interface:RateLimitingQueue
Adds an item to the work queue after the rate limiter says it is ok.- Specified by:
addRateLimited
in interfaceRateLimitingQueue<T>
- Parameters:
item
- item to add
-
shutdown
public void shutdown()Description copied from interface:WorkQueue
Initiates a shutdown of the work queue. All added items whose processing not started will be ignored and removed from the queue.
-