@Beta @GwtCompatible(emulated=true) public final class Uninterruptibles extends Object
Modifier and Type | Method and Description |
---|---|
static boolean |
awaitUninterruptibly(Condition condition,
long timeout,
TimeUnit unit)
Invokes
condition. await(timeout, unit)
uninterruptibly. |
static void |
awaitUninterruptibly(CountDownLatch latch)
Invokes
latch. await() uninterruptibly. |
static boolean |
awaitUninterruptibly(CountDownLatch latch,
long timeout,
TimeUnit unit)
Invokes
latch. await(timeout, unit)
uninterruptibly. |
static <V> V |
getUninterruptibly(Future<V> future)
Invokes
future. get() uninterruptibly. |
static <V> V |
getUninterruptibly(Future<V> future,
long timeout,
TimeUnit unit)
Invokes
future. get(timeout, unit) uninterruptibly. |
static void |
joinUninterruptibly(Thread toJoin)
Invokes
toJoin. join() uninterruptibly. |
static void |
joinUninterruptibly(Thread toJoin,
long timeout,
TimeUnit unit)
Invokes
unit. timedJoin(toJoin, timeout)
uninterruptibly. |
static <E> void |
putUninterruptibly(BlockingQueue<E> queue,
E element)
Invokes
queue. put(element) uninterruptibly. |
static void |
sleepUninterruptibly(long sleepFor,
TimeUnit unit)
Invokes
unit. sleep(sleepFor) uninterruptibly. |
static <E> E |
takeUninterruptibly(BlockingQueue<E> queue)
Invokes
queue. take() uninterruptibly. |
static boolean |
tryAcquireUninterruptibly(Semaphore semaphore,
int permits,
long timeout,
TimeUnit unit)
Invokes
semaphore. tryAcquire(permits,
timeout, unit) uninterruptibly. |
static boolean |
tryAcquireUninterruptibly(Semaphore semaphore,
long timeout,
TimeUnit unit)
Invokes
semaphore. tryAcquire(1,
timeout, unit) uninterruptibly. |
@GwtIncompatible public static void awaitUninterruptibly(CountDownLatch latch)
latch.
await()
uninterruptibly.@CanIgnoreReturnValue @GwtIncompatible public static boolean awaitUninterruptibly(CountDownLatch latch, long timeout, TimeUnit unit)
latch.
await(timeout, unit)
uninterruptibly.@GwtIncompatible public static boolean awaitUninterruptibly(Condition condition, long timeout, TimeUnit unit)
condition.
await(timeout, unit)
uninterruptibly.@GwtIncompatible public static void joinUninterruptibly(Thread toJoin)
toJoin.
join()
uninterruptibly.@GwtIncompatible public static void joinUninterruptibly(Thread toJoin, long timeout, TimeUnit unit)
unit.
timedJoin(toJoin, timeout)
uninterruptibly.@CanIgnoreReturnValue public static <V> V getUninterruptibly(Future<V> future) throws ExecutionException
future.
get()
uninterruptibly.
Similar methods:
Future
that is already done, use Futures.getDone
.
InterruptedException
uniformly with other exceptions, use Futures.getChecked
.
Futures.getUnchecked(java.util.concurrent.Future<V>)
.
ExecutionException
- if the computation threw an exceptionCancellationException
- if the computation was cancelled@CanIgnoreReturnValue @GwtIncompatible public static <V> V getUninterruptibly(Future<V> future, long timeout, TimeUnit unit) throws ExecutionException, TimeoutException
future.
get(timeout, unit)
uninterruptibly.
Similar methods:
Future
that is already done, use Futures.getDone
.
InterruptedException
uniformly with other exceptions, use Futures.getChecked
.
Futures.getUnchecked(java.util.concurrent.Future<V>)
.
ExecutionException
- if the computation threw an exceptionCancellationException
- if the computation was cancelledTimeoutException
- if the wait timed out@GwtIncompatible public static <E> E takeUninterruptibly(BlockingQueue<E> queue)
queue.
take()
uninterruptibly.@GwtIncompatible public static <E> void putUninterruptibly(BlockingQueue<E> queue, E element)
queue.
put(element)
uninterruptibly.ClassCastException
- if the class of the specified element prevents it from being added
to the given queueIllegalArgumentException
- if some property of the specified element prevents it from
being added to the given queue@GwtIncompatible public static void sleepUninterruptibly(long sleepFor, TimeUnit unit)
unit.
sleep(sleepFor)
uninterruptibly.@GwtIncompatible public static boolean tryAcquireUninterruptibly(Semaphore semaphore, long timeout, TimeUnit unit)
semaphore.
tryAcquire(1,
timeout, unit)
uninterruptibly.@GwtIncompatible public static boolean tryAcquireUninterruptibly(Semaphore semaphore, int permits, long timeout, TimeUnit unit)
semaphore.
tryAcquire(permits,
timeout, unit)
uninterruptibly.Copyright © 2010–2018. All rights reserved.