|
JavaTM 2 Platform Standard Ed. 5.0 |
|||||||||
PREV NEXT | FRAMES NO FRAMES |
Packages that use TimeUnit | |
---|---|
java.util.concurrent | Utility classes commonly useful in concurrent programming. |
java.util.concurrent.locks | Interfaces and classes providing a framework for locking and waiting for conditions that is distinct from built-in synchronization and monitors. |
Uses of TimeUnit in java.util.concurrent |
---|
Methods in java.util.concurrent that return TimeUnit | |
---|---|
static TimeUnit |
TimeUnit.valueOf(String name)
Returns the enum constant of this type with the specified name. |
static TimeUnit[] |
TimeUnit.values()
Returns an array containing the constants of this enum type, in the order they're declared. |
Methods in java.util.concurrent with parameters of type TimeUnit | ||
---|---|---|
int |
CyclicBarrier.await(long timeout,
TimeUnit unit)
Waits until all parties have invoked await
on this barrier. |
|
boolean |
CountDownLatch.await(long timeout,
TimeUnit unit)
Causes the current thread to wait until the latch has counted down to zero, unless the thread is interrupted ,
or the specified waiting time elapses. |
|
boolean |
ThreadPoolExecutor.awaitTermination(long timeout,
TimeUnit unit)
|
|
boolean |
ExecutorService.awaitTermination(long timeout,
TimeUnit unit)
Blocks until all tasks have completed execution after a shutdown request, or the timeout occurs, or the current thread is interrupted, whichever happens first. |
|
long |
TimeUnit.convert(long duration,
TimeUnit unit)
Convert the given time duration in the given unit to this unit. |
|
V |
Exchanger.exchange(V x,
long timeout,
TimeUnit unit)
Waits for another thread to arrive at this exchange point (unless it is interrupted , or the specified waiting
time elapses),
and then transfers the given object to it, receiving its object
in return. |
|
V |
FutureTask.get(long timeout,
TimeUnit unit)
|
|
V |
Future.get(long timeout,
TimeUnit unit)
Waits if necessary for at most the given time for the computation to complete, and then retrieves its result, if available. |
|
long |
Delayed.getDelay(TimeUnit unit)
Returns the remaining delay associated with this object, in the given time unit. |
|
long |
ThreadPoolExecutor.getKeepAliveTime(TimeUnit unit)
Returns the thread keep-alive time, which is the amount of time which threads in excess of the core pool size may remain idle before being terminated. |
|
|
ExecutorService.invokeAll(Collection<Callable<T>> tasks,
long timeout,
TimeUnit unit)
Executes the given tasks, returning a list of Futures holding their status and results when all complete or the timeout expires, whichever happens first. |
|
|
AbstractExecutorService.invokeAll(Collection<Callable<T>> tasks,
long timeout,
TimeUnit unit)
|
|
|
ExecutorService.invokeAny(Collection<Callable<T>> tasks,
long timeout,
TimeUnit unit)
Executes the given tasks, returning the result of one that has completed successfully (i.e., without throwing an exception), if any do before the given timeout elapses. |
|
|
AbstractExecutorService.invokeAny(Collection<Callable<T>> tasks,
long timeout,
TimeUnit unit)
|
|
boolean |
SynchronousQueue.offer(E o,
long timeout,
TimeUnit unit)
Inserts the specified element into this queue, waiting if necessary up to the specified wait time for another thread to receive it. |
|
boolean |
PriorityBlockingQueue.offer(E o,
long timeout,
TimeUnit unit)
Inserts the specified element into this priority queue. |
|
boolean |
LinkedBlockingQueue.offer(E o,
long timeout,
TimeUnit unit)
Inserts the specified element at the tail of this queue, waiting if necessary up to the specified wait time for space to become available. |
|
boolean |
DelayQueue.offer(E o,
long timeout,
TimeUnit unit)
Inserts the specified element into this delay queue. |
|
boolean |
BlockingQueue.offer(E o,
long timeout,
TimeUnit unit)
Inserts the specified element into this queue, waiting if necessary up to the specified wait time for space to become available. |
|
boolean |
ArrayBlockingQueue.offer(E o,
long timeout,
TimeUnit unit)
Inserts the specified element at the tail of this queue, waiting if necessary up to the specified wait time for space to become available. |
|
E |
SynchronousQueue.poll(long timeout,
TimeUnit unit)
Retrieves and removes the head of this queue, waiting if necessary up to the specified wait time, for another thread to insert it. |
|
E |
PriorityBlockingQueue.poll(long timeout,
TimeUnit unit)
|
|
E |
LinkedBlockingQueue.poll(long timeout,
TimeUnit unit)
|
|
Future<V> |
ExecutorCompletionService.poll(long timeout,
TimeUnit unit)
|
|
E |
DelayQueue.poll(long timeout,
TimeUnit unit)
Retrieves and removes the head of this queue, waiting if necessary up to the specified wait time if no elements with an unexpired delay are present on this queue. |
|
Future<V> |
CompletionService.poll(long timeout,
TimeUnit unit)
Retrieves and removes the Future representing the next completed task, waiting if necessary up to the specified wait time if none are yet present. |
|
E |
BlockingQueue.poll(long timeout,
TimeUnit unit)
Retrieves and removes the head of this queue, waiting if necessary up to the specified wait time if no elements are present on this queue. |
|
E |
ArrayBlockingQueue.poll(long timeout,
TimeUnit unit)
|
|
|
ScheduledThreadPoolExecutor.schedule(Callable<V> callable,
long delay,
TimeUnit unit)
|
|
|
ScheduledExecutorService.schedule(Callable<V> callable,
long delay,
TimeUnit unit)
Creates and executes a ScheduledFuture that becomes enabled after the given delay. |
|
ScheduledFuture<?> |
ScheduledThreadPoolExecutor.schedule(Runnable command,
long delay,
TimeUnit unit)
|
|
ScheduledFuture<?> |
ScheduledExecutorService.schedule(Runnable command,
long delay,
TimeUnit unit)
Creates and executes a one-shot action that becomes enabled after the given delay. |
|
ScheduledFuture<?> |
ScheduledThreadPoolExecutor.scheduleAtFixedRate(Runnable command,
long initialDelay,
long period,
TimeUnit unit)
|
|
ScheduledFuture<?> |
ScheduledExecutorService.scheduleAtFixedRate(Runnable command,
long initialDelay,
long period,
TimeUnit unit)
Creates and executes a periodic action that becomes enabled first after the given initial delay, and subsequently with the given period; that is executions will commence after initialDelay then initialDelay+period, then initialDelay + 2 * period, and so on. |
|
ScheduledFuture<?> |
ScheduledThreadPoolExecutor.scheduleWithFixedDelay(Runnable command,
long initialDelay,
long delay,
TimeUnit unit)
|
|
ScheduledFuture<?> |
ScheduledExecutorService.scheduleWithFixedDelay(Runnable command,
long initialDelay,
long delay,
TimeUnit unit)
Creates and executes a periodic action that becomes enabled first after the given initial delay, and subsequently with the given delay between the termination of one execution and the commencement of the next. |
|
void |
ThreadPoolExecutor.setKeepAliveTime(long time,
TimeUnit unit)
Sets the time limit for which threads may remain idle before being terminated. |
|
boolean |
Semaphore.tryAcquire(int permits,
long timeout,
TimeUnit unit)
Acquires the given number of permits from this semaphore, if all become available within the given waiting time and the current thread has not been interrupted . |
|
boolean |
Semaphore.tryAcquire(long timeout,
TimeUnit unit)
Acquires a permit from this semaphore, if one becomes available within the given waiting time and the current thread has not been interrupted . |
Constructors in java.util.concurrent with parameters of type TimeUnit | |
---|---|
ThreadPoolExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit,
BlockingQueue<Runnable> workQueue)
Creates a new ThreadPoolExecutor with the given initial parameters and default thread factory and handler. |
|
ThreadPoolExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit,
BlockingQueue<Runnable> workQueue,
RejectedExecutionHandler handler)
Creates a new ThreadPoolExecutor with the given initial parameters. |
|
ThreadPoolExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit,
BlockingQueue<Runnable> workQueue,
ThreadFactory threadFactory)
Creates a new ThreadPoolExecutor with the given initial parameters. |
|
ThreadPoolExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit,
BlockingQueue<Runnable> workQueue,
ThreadFactory threadFactory,
RejectedExecutionHandler handler)
Creates a new ThreadPoolExecutor with the given initial parameters. |
Uses of TimeUnit in java.util.concurrent.locks |
---|
Methods in java.util.concurrent.locks with parameters of type TimeUnit | |
---|---|
boolean |
AbstractQueuedSynchronizer.ConditionObject.await(long time,
TimeUnit unit)
Implements timed condition wait. |
boolean |
Condition.await(long time,
TimeUnit unit)
Causes the current thread to wait until it is signalled or interrupted, or the specified waiting time elapses. |
boolean |
ReentrantReadWriteLock.ReadLock.tryLock(long timeout,
TimeUnit unit)
Acquires the read lock if the write lock is not held by another thread within the given waiting time and the current thread has not been interrupted . |
boolean |
ReentrantReadWriteLock.WriteLock.tryLock(long timeout,
TimeUnit unit)
Acquires the write lock if it is not held by another thread within the given waiting time and the current thread has not been interrupted . |
boolean |
Lock.tryLock(long time,
TimeUnit unit)
Acquires the lock if it is free within the given waiting time and the current thread has not been interrupted . |
boolean |
ReentrantLock.tryLock(long timeout,
TimeUnit unit)
Acquires the lock if it is not held by another thread within the given waiting time and the current thread has not been interrupted . |
|
JavaTM 2 Platform Standard Ed. 5.0 |
|||||||||
PREV NEXT | FRAMES NO FRAMES |
Copyright 2004 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.