public final class Uninterrupteds extends Object
| 限定符和类型 | 方法和说明 |
|---|---|
static void |
awaitUninterrupted(CountDownLatch latch)
Invokes
latch. |
static boolean |
awaitUninterrupted(CountDownLatch latch,
long timeout,
TimeUnit unit)
Invokes
latch. |
static <V> V |
getUninterrupted(Future<V> future)
Invokes
future. |
static <V> V |
getUninterrupted(Future<V> future,
long timeout,
TimeUnit unit)
Invokes
future. |
static void |
joinUninterrupted(Thread toJoin)
Invokes
toJoin. |
static void |
joinUninterrupted(Thread toJoin,
long timeout,
TimeUnit unit)
Invokes
unit. |
static <E> void |
putUninterrupted(BlockingQueue<E> queue,
E element)
Invokes
queue. |
static void |
sleepUninterrupted(long sleepFor,
TimeUnit unit)
Invokes
unit. |
static <E> E |
takeUninterrupted(BlockingQueue<E> queue)
Invokes
queue. |
static boolean |
tryAcquireUninterrupted(Semaphore semaphore,
int permits,
long timeout,
TimeUnit unit)
Invokes
semaphore. |
static boolean |
tryAcquireUninterrupted(Semaphore semaphore,
long timeout,
TimeUnit unit)
Invokes
semaphore. |
public static void awaitUninterrupted(CountDownLatch latch)
latch.await() uninterrupted.public static boolean awaitUninterrupted(CountDownLatch latch, long timeout, TimeUnit unit)
latch.await(timeout, unit)
uninterrupted.public static void joinUninterrupted(Thread toJoin)
toJoin.join() uninterrupted.public static <V> V getUninterrupted(Future<V> future) throws ExecutionException
future.get() uninterrupted.ExecutionException - if the computation threw an exceptionCancellationException - if the computation was cancelledpublic static <V> V getUninterrupted(Future<V> future, long timeout, TimeUnit unit) throws ExecutionException, TimeoutException
future.get(timeout, unit) uninterrupted.ExecutionException - if the computation threw an exceptionCancellationException - if the computation was cancelledTimeoutException - if the wait timed outpublic static void joinUninterrupted(Thread toJoin, long timeout, TimeUnit unit)
unit.timedJoin(toJoin, timeout)
uninterrupted.public static <E> E takeUninterrupted(BlockingQueue<E> queue)
queue.take() uninterrupted.public static <E> void putUninterrupted(BlockingQueue<E> queue, E element)
queue.put(element) uninterrupted.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 queuepublic static void sleepUninterrupted(long sleepFor,
TimeUnit unit)
unit.sleep(sleepFor) uninterrupted.public static boolean tryAcquireUninterrupted(Semaphore semaphore, long timeout, TimeUnit unit)
semaphore.tryAcquire(1,
timeout, unit) uninterrupted.public static boolean tryAcquireUninterrupted(Semaphore semaphore, int permits, long timeout, TimeUnit unit)
semaphore.tryAcquire(permits,
timeout, unit) uninterrupted.Copyright © 2020. All rights reserved.