Interface AsyncChecker<K,V>
- All Known Implementing Classes:
ThrottledAsyncChecker
@Private
@Unstable
public interface AsyncChecker<K,V>
A class that can be used to schedule an asynchronous check on a given
Checkable. If the check is successfully scheduled then a
ListenableFuture is returned.-
Method Summary
Modifier and TypeMethodDescriptionSchedule an asynchronous check for the given object.voidshutdownAndWait(long timeout, TimeUnit timeUnit) Cancel all executing checks and wait for them to complete.
-
Method Details
-
schedule
Optional<org.apache.hadoop.thirdparty.com.google.common.util.concurrent.ListenableFuture<V>> schedule(Checkable<K, V> target, K context) Schedule an asynchronous check for the given object.- Parameters:
target- object to be checked.context- the interpretation of the context depends on the target.- Returns:
- returns a
of ListenableFuturethat can be used to retrieve the result of the asynchronous check.
-
shutdownAndWait
Cancel all executing checks and wait for them to complete. First attempts a graceful cancellation, then cancels forcefully. Waits for the supplied timeout after both attempts. SeeExecutorService.awaitTermination(long, java.util.concurrent.TimeUnit)for a description of the parameters.- Throws:
InterruptedException
-