Modifier and Type | Method and Description |
---|---|
static TimeUnit |
TimeUnit.valueOf(java.lang.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 are declared.
|
Modifier and Type | Method and Description |
---|---|
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 sourceDuration,
TimeUnit sourceUnit)
Convert the given time duration in the given unit to this 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.
|
<T> java.util.List<Future<T>> |
ExecutorService.invokeAll(java.util.Collection<? extends 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.
|
<T> T |
ExecutorService.invokeAny(java.util.Collection<? extends 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.
|
<V> ScheduledFuture<V> |
ScheduledExecutorService.schedule(Callable<V> callable,
long delay,
TimeUnit unit)
Creates and executes a ScheduledFuture that becomes enabled after the given delay.
|
ScheduledFuture<?> |
ScheduledExecutorService.schedule(java.lang.Runnable command,
long delay,
TimeUnit unit)
Creates and executes a one-shot action that becomes enabled after the given delay.
|
ScheduledFuture<?> |
ScheduledExecutorService.scheduleAtFixedRate(java.lang.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<?> |
ScheduledExecutorService.scheduleWithFixedDelay(java.lang.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.
|