public final class TimeoutScheduler extends Object implements Closeable
| Modifier and Type | Field and Description |
|---|---|
static org.slf4j.Logger |
LOG |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
static TimeoutScheduler |
getInstance() |
void |
onTimeout(TimeDuration timeout,
CheckedRunnable<?> task,
org.slf4j.Logger log,
Supplier<String> errorMessage)
When timeout, run the task.
|
<THROWABLE extends Throwable> |
onTimeout(TimeDuration timeout,
CheckedRunnable<THROWABLE> task,
Consumer<THROWABLE> errorHandler)
Schedule a timeout task.
|
public static TimeoutScheduler getInstance()
public <THROWABLE extends Throwable> void onTimeout(TimeDuration timeout, CheckedRunnable<THROWABLE> task, Consumer<THROWABLE> errorHandler)
timeout - the timeout value.task - the task to run when timeout.errorHandler - to handle the error, if there is any.public void onTimeout(TimeDuration timeout, CheckedRunnable<?> task, org.slf4j.Logger log, Supplier<String> errorMessage)
public void close()
close in interface Closeableclose in interface AutoCloseableCopyright © 2017–2022 The Apache Software Foundation. All rights reserved.