Class WakeupTrigger
java.lang.Object
org.apache.kafka.clients.consumer.internals.WakeupTrigger
Ensures blocking APIs can be woken up by the consumer.wakeup().
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoid<T> CompletableFuture<T> setActiveTask(CompletableFuture<T> currentTask) If there is no pending task, set the pending task active.voidsetFetchAction(FetchBuffer fetchBuffer) voidwakeup()Wakeup a pending task.
-
Constructor Details
-
WakeupTrigger
public WakeupTrigger()
-
-
Method Details
-
wakeup
public void wakeup()Wakeup a pending task. If there isn't any pending task, return a WakeupFuture, so that the subsequent call would know wakeup was previously called.If there are active tasks, complete it with WakeupException, then unset pending task (return null here. If the current task has already been woken-up, do nothing.
-
setActiveTask
If there is no pending task, set the pending task active. If wakeup was called before setting an active task, the current task will complete exceptionally with WakeupException right away. if there is an active task, throw exception.- Type Parameters:
T-- Parameters:
currentTask-- Returns:
-
setFetchAction
-
clearTask
public void clearTask() -
maybeTriggerWakeup
public void maybeTriggerWakeup()
-