@Beta public final class Uninterruptibles extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
awaitUninterruptibly(CountDownLatch
Invokes
latch.
await() uninterruptibly.
|
static boolean |
awaitUninterruptibly(CountDownLatch
Invokes
latch.
await(timeout, unit) uninterruptibly.
|
static <V> V |
getUninterruptibly(Future
Invokes
future.
get() uninterruptibly.
|
static <V> V |
getUninterruptibly(Future
Invokes
future.
get(timeout, unit) uninterruptibly.
|
static void |
joinUninterruptibly(Thread
Invokes
toJoin.
join() uninterruptibly.
|
static void |
joinUninterruptibly(Thread
Invokes
unit.
timedJoin(toJoin, timeout) uninterruptibly.
|
static <E> void |
putUninterruptibly(BlockingQueue
Invokes
queue.
put(element) uninterruptibly.
|
static void |
sleepUninterruptibly(long sleepFor, TimeUnit
Invokes
unit.
sleep(sleepFor) uninterruptibly.
|
static <E> E |
takeUninterruptibly(BlockingQueue
Invokes
queue.
take() uninterruptibly.
|
static boolean |
tryAcquireUninterruptibly(Semaphore
Invokes
semaphore.
tryAcquire(permits, timeout, unit) uninterruptibly.
|
static boolean |
tryAcquireUninterruptibly(Semaphore
Invokes
semaphore.
tryAcquire(1, timeout, unit) uninterruptibly.
|
public static void awaitUninterruptibly(CountDownLatchlatch)
latch.
await() uninterruptibly.
public static boolean awaitUninterruptibly(CountDownLatchlatch, long timeout, TimeUnit unit)
latch.
await(timeout, unit) uninterruptibly.
public static void joinUninterruptibly(ThreadtoJoin)
toJoin.
join() uninterruptibly.
public static <V> V getUninterruptibly(Future<V> future) throws ExecutionException
future.
get() uninterruptibly. To get uninterruptibility and remove checked exceptions, see
Futures.getUnchecked(java.util.concurrent.Future<V>) .
If instead, you wish to treat InterruptedException uniformly with other exceptions, see Futures.get or Futures.
ExecutionException - if the computation threw an exception
CancellationException - if the computation was cancelled
public static <V> V getUninterruptibly(Future<V> future, long timeout, TimeUnit unit) throws ExecutionException , TimeoutException
future.
get(timeout, unit) uninterruptibly.
If instead, you wish to treat InterruptedException uniformly with other exceptions, see Futures.get or Futures.
ExecutionException - if the computation threw an exception
CancellationException - if the computation was cancelled
TimeoutException - if the wait timed out
public static void joinUninterruptibly(ThreadtoJoin, long timeout, TimeUnit unit)
unit.
timedJoin(toJoin, timeout) uninterruptibly.
public static <E> E takeUninterruptibly(BlockingQueue<E> queue)
queue.
take() uninterruptibly.
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 queue
IllegalArgumentException - if some property of the specified element prevents it from being added to the given queue
public static void sleepUninterruptibly(long sleepFor,
TimeUnit unit)
unit.
sleep(sleepFor) uninterruptibly.
public static boolean tryAcquireUninterruptibly(Semaphoresemaphore, long timeout, TimeUnit unit)
semaphore.
tryAcquire(1, timeout, unit) uninterruptibly.
public static boolean tryAcquireUninterruptibly(Semaphoresemaphore, int permits, long timeout, TimeUnit unit)
semaphore.
tryAcquire(permits, timeout, unit) uninterruptibly.