Package org.awaitility.core
Class Uninterruptibles
java.lang.Object
org.awaitility.core.Uninterruptibles
These code snippets are copied from the Guava library (e.g. Uninterruptibles#sleepUninterruptibly)
to solve issue 134.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static <V> VgetUninterruptibly(Future<V> future) Invokesfuture.get()uninterruptibly.(package private) static <V> VgetUninterruptibly(Future<V> future, long timeout, TimeUnit unit) Invokesfuture.get(timeout, unit)uninterruptibly.(package private) static <V> VgetUninterruptibly(Future<V> future, Duration timeout) Invokesfuture.get(timeout, unit)uninterruptibly.private static longsaturatedToNanos(Duration duration) Returns the number of nanoseconds of the given duration without throwing or overflowing.(package private) static voidshutdownUninterruptibly(ExecutorService executor, long timeout, TimeUnit unit) Shuts down an executor service uninterruptedly Note that this method is created by Johan Haleby and is thus not covered by the Guava license(package private) static voidsleepUninterruptibly(long sleepFor, TimeUnit unit)
-
Constructor Details
-
Uninterruptibles
Uninterruptibles()
-
-
Method Details
-
sleepUninterruptibly
-
getUninterruptibly
Invokesfuture.get()uninterruptibly.- Throws:
ExecutionException- if the computation threw an exceptionCancellationException- if the computation was cancelled
-
getUninterruptibly
static <V> V getUninterruptibly(Future<V> future, Duration timeout) throws ExecutionException, TimeoutException Invokesfuture.get(timeout, unit)uninterruptibly.- Throws:
ExecutionException- if the computation threw an exceptionCancellationException- if the computation was cancelledTimeoutException- if the wait timed out
-
getUninterruptibly
static <V> V getUninterruptibly(Future<V> future, long timeout, TimeUnit unit) throws ExecutionException, TimeoutException Invokesfuture.get(timeout, unit)uninterruptibly.- Throws:
ExecutionException- if the computation threw an exceptionCancellationException- if the computation was cancelledTimeoutException- if the wait timed out
-
shutdownUninterruptibly
Shuts down an executor service uninterruptedly Note that this method is created by Johan Haleby and is thus not covered by the Guava license- Parameters:
executor- The executor service to shut downtimeout- The timeout amountunit- The time unit
-
saturatedToNanos
Returns the number of nanoseconds of the given duration without throwing or overflowing.Instead of throwing
ArithmeticException, this method silently saturates to eitherLong.MAX_VALUEorLong.MIN_VALUE. This behavior can be useful when decomposing a duration in order to call a legacy API which requires along, TimeUnitpair.
-