Package org.awaitility.core
Class Uninterruptibles
- java.lang.Object
-
- org.awaitility.core.Uninterruptibles
-
class Uninterruptibles extends java.lang.ObjectThese code snippets are copied from the Guava library (e.g. Uninterruptibles#sleepUninterruptibly) to solve issue 134.
-
-
Constructor Summary
Constructors Constructor Description Uninterruptibles()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description (package private) static <V> VgetUninterruptibly(java.util.concurrent.Future<V> future)Invokesfuture.get()uninterruptibly.(package private) static <V> VgetUninterruptibly(java.util.concurrent.Future<V> future, long timeout, java.util.concurrent.TimeUnit unit)Invokesfuture.get(timeout, unit)uninterruptibly.(package private) static <V> VgetUninterruptibly(java.util.concurrent.Future<V> future, java.time.Duration timeout)Invokesfuture.get(timeout, unit)uninterruptibly.private static longsaturatedToNanos(java.time.Duration duration)Returns the number of nanoseconds of the given duration without throwing or overflowing.(package private) static voidshutdownUninterruptibly(java.util.concurrent.ExecutorService executor, long timeout, java.util.concurrent.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, java.util.concurrent.TimeUnit unit)
-
-
-
Method Detail
-
sleepUninterruptibly
static void sleepUninterruptibly(long sleepFor, java.util.concurrent.TimeUnit unit)
-
getUninterruptibly
static <V> V getUninterruptibly(java.util.concurrent.Future<V> future) throws java.util.concurrent.ExecutionExceptionInvokesfuture.get()uninterruptibly.- Throws:
java.util.concurrent.ExecutionException- if the computation threw an exceptionjava.util.concurrent.CancellationException- if the computation was cancelled
-
getUninterruptibly
static <V> V getUninterruptibly(java.util.concurrent.Future<V> future, java.time.Duration timeout) throws java.util.concurrent.ExecutionException, java.util.concurrent.TimeoutExceptionInvokesfuture.get(timeout, unit)uninterruptibly.- Throws:
java.util.concurrent.ExecutionException- if the computation threw an exceptionjava.util.concurrent.CancellationException- if the computation was cancelledjava.util.concurrent.TimeoutException- if the wait timed out
-
getUninterruptibly
static <V> V getUninterruptibly(java.util.concurrent.Future<V> future, long timeout, java.util.concurrent.TimeUnit unit) throws java.util.concurrent.ExecutionException, java.util.concurrent.TimeoutExceptionInvokesfuture.get(timeout, unit)uninterruptibly.- Throws:
java.util.concurrent.ExecutionException- if the computation threw an exceptionjava.util.concurrent.CancellationException- if the computation was cancelledjava.util.concurrent.TimeoutException- if the wait timed out
-
shutdownUninterruptibly
static void shutdownUninterruptibly(java.util.concurrent.ExecutorService executor, long timeout, java.util.concurrent.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- Parameters:
executor- The executor service to shut downtimeout- The timeout amountunit- The time unit
-
saturatedToNanos
private static long saturatedToNanos(java.time.Duration duration)
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.
-
-