|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.google.common.util.concurrent.Uninterruptibles
@Beta public final class Uninterruptibles
Utilities for treating interruptible operations as uninterruptible. In all cases, if a thread is interrupted during such a call, the call continues to block until the result is available or the timeout elapses, and only then re-interrupts the thread.
Method Summary | ||
---|---|---|
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
|
getUninterruptibly(Future<V> future)
Invokes future. get() uninterruptibly. |
|
static
|
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
|
putUninterruptibly(BlockingQueue<E> queue,
E element)
Invokes queue. put(element)
uninterruptibly. |
|
static void |
sleepUninterruptibly(long sleepFor,
TimeUnit unit)
Invokes unit. sleep(sleepFor)
uninterruptibly. |
|
static
|
takeUninterruptibly(BlockingQueue<E> queue)
Invokes queue. take() uninterruptibly. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static void awaitUninterruptibly(CountDownLatch latch)
latch.
await()
uninterruptibly.
public static boolean awaitUninterruptibly(CountDownLatch latch, long timeout, TimeUnit unit)
latch.
await(timeout, unit)
uninterruptibly.
public static void joinUninterruptibly(Thread toJoin)
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)
.
If instead, you wish to treat InterruptedException
uniformly
with other exceptions, see Futures.get
or Futures.makeChecked(java.util.concurrent.Future
.
ExecutionException
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.makeChecked(java.util.concurrent.Future
.
ExecutionException
TimeoutException
public static void joinUninterruptibly(Thread toJoin, 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.
public static void sleepUninterruptibly(long sleepFor, TimeUnit unit)
unit.
sleep(sleepFor)
uninterruptibly.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |