Uses of Enum Class
java.util.concurrent.TimeUnit
Packages that use TimeUnit
Package
Description
Provides classes that are fundamental to the design of the Java
programming language.
Defines channels, which represent connections to entities that are capable of
performing I/O operations, such as files and sockets; defines selectors, for
multiplexed, non-blocking I/O operations.
Defines interfaces and classes for the Java virtual machine to access files,
file attributes, and file systems.
Interfaces and classes providing access to file and file system attributes.
Utility classes commonly useful in concurrent programming.
Interfaces and classes providing a framework for locking and waiting
for conditions that is distinct from built-in synchronization and
monitors.
Provides a set of "lightweight" (all-Java language) components
that, to the maximum degree possible, work the same on all platforms.
-
Uses of TimeUnit in java.lang
-
Uses of TimeUnit in java.nio.channels
Methods in java.nio.channels with parameters of type TimeUnitModifier and TypeMethodDescriptionabstract booleanAsynchronousChannelGroup.awaitTermination(long timeout, TimeUnit unit) Awaits termination of the group.abstract <A> voidAsynchronousSocketChannel.read(ByteBuffer[] dsts, int offset, int length, long timeout, TimeUnit unit, A attachment, CompletionHandler<Long, ? super A> handler) Reads a sequence of bytes from this channel into a subsequence of the given buffers.abstract <A> voidAsynchronousSocketChannel.read(ByteBuffer dst, long timeout, TimeUnit unit, A attachment, CompletionHandler<Integer, ? super A> handler) Reads a sequence of bytes from this channel into the given buffer.abstract <A> voidAsynchronousSocketChannel.write(ByteBuffer[] srcs, int offset, int length, long timeout, TimeUnit unit, A attachment, CompletionHandler<Long, ? super A> handler) Writes a sequence of bytes to this channel from a subsequence of the given buffers.abstract <A> voidAsynchronousSocketChannel.write(ByteBuffer src, long timeout, TimeUnit unit, A attachment, CompletionHandler<Integer, ? super A> handler) Writes a sequence of bytes to this channel from the given buffer. -
Uses of TimeUnit in java.nio.file
Methods in java.nio.file with parameters of type TimeUnit -
Uses of TimeUnit in java.nio.file.attribute
Methods in java.nio.file.attribute with parameters of type TimeUnit -
Uses of TimeUnit in java.util.concurrent
Methods in java.util.concurrent that return TimeUnitModifier and TypeMethodDescriptionstatic TimeUnitTimeUnit.of(ChronoUnit chronoUnit) Converts aChronoUnitto the equivalentTimeUnit.static TimeUnitReturns the enum constant of this class with the specified name.static TimeUnit[]TimeUnit.values()Returns an array containing the constants of this enum class, in the order they are declared.Methods in java.util.concurrent with parameters of type TimeUnitModifier and TypeMethodDescriptionbooleanCauses the current thread to wait until the latch has counted down to zero, unless the thread is interrupted, or the specified waiting time elapses.intWaits until all parties have invokedawaiton this barrier, or the specified waiting time elapses.intPhaser.awaitAdvanceInterruptibly(int phase, long timeout, TimeUnit unit) Awaits the phase of this phaser to advance from the given phase value or the given timeout to elapse, throwingInterruptedExceptionif interrupted while waiting, or returning immediately if the current phase is not equal to the given phase value or this phaser is terminated.booleanForkJoinPool.awaitQuiescence(long timeout, TimeUnit unit) If called by a ForkJoinTask operating in this pool, equivalent in effect toForkJoinTask.helpQuiesce().booleanExecutorService.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.booleanForkJoinPool.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.booleanThreadPoolExecutor.awaitTermination(long timeout, TimeUnit unit) CompletableFuture.completeOnTimeout(T value, long timeout, TimeUnit unit) Completes this CompletableFuture with the given value if not otherwise completed before the given timeout.longConverts the given time duration in the given unit to this unit.static ExecutorCompletableFuture.delayedExecutor(long delay, TimeUnit unit) Returns a new Executor that submits a task to the default executor after the given delay (or no delay if non-positive).static ExecutorCompletableFuture.delayedExecutor(long delay, TimeUnit unit, Executor executor) Returns a new Executor that submits a task to the given base executor after the given delay (or no delay if non-positive).Waits for another thread to arrive at this exchange point (unless the current thread is interrupted or the specified waiting time elapses), and then transfers the given object to it, receiving its object in return.Waits if necessary for at most the given time for this future to complete, and then returns its result, if available.final VWaits if necessary for at most the given time for the computation to complete, and then retrieves its result, if available.Waits if necessary for at most the given time for the computation to complete, and then retrieves its result, if available.longReturns the remaining delay associated with this object, in the given time unit.longThreadPoolExecutor.getKeepAliveTime(TimeUnit unit) Returns the thread keep-alive time, which is the amount of time that threads may remain idle before being terminated.AbstractExecutorService.invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) ExecutorService.invokeAll(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> TAbstractExecutorService.invokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) <T> TExecutorService.invokeAny(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.booleanInserts the specified element at the tail of this queue, waiting up to the specified wait time for space to become available if the queue is full.booleanInserts the specified element into the queue represented by this deque (in other words, at the tail of this deque), waiting up to the specified wait time if necessary for space to become available.booleanInserts the specified element into this queue, waiting up to the specified wait time if necessary for space to become available.booleanInserts the specified element into this delay queue.booleanbooleanInserts the specified element at the tail of this queue, waiting if necessary up to the specified wait time for space to become available.booleanInserts the specified element at the tail of this queue.booleanInserts the specified element into this priority queue.intSubmissionPublisher.offer(T item, long timeout, TimeUnit unit, BiPredicate<Flow.Subscriber<? super T>, ? super T> onDrop) Publishes the given item, if possible, to each current subscriber by asynchronously invoking itsonNextmethod, blocking while resources for any subscription are unavailable, up to the specified timeout or until the caller thread is interrupted, at which point the given handler (if non-null) is invoked, and if it returns true, retried once.booleanInserts the specified element into this queue, waiting if necessary up to the specified wait time for another thread to receive it.booleanBlockingDeque.offerFirst(E e, long timeout, TimeUnit unit) Inserts the specified element at the front of this deque, waiting up to the specified wait time if necessary for space to become available.booleanLinkedBlockingDeque.offerFirst(E e, long timeout, TimeUnit unit) booleanInserts the specified element at the end of this deque, waiting up to the specified wait time if necessary for space to become available.booleanExceptionally completes this CompletableFuture with aTimeoutExceptionif not otherwise completed before the given timeout.Retrieves and removes the head of the queue represented by this deque (in other words, the first element of this deque), waiting up to the specified wait time if necessary for an element to become available.Retrieves and removes the head of this queue, waiting up to the specified wait time if necessary for an element to become available.Retrieves and removes the Future representing the next completed task, waiting if necessary up to the specified wait time if none are yet present.Retrieves and removes the expired head of this queue, waiting if necessary until an expired element is available on this queue, or the specified wait time expires.Retrieves and removes the head of this queue, waiting if necessary up to the specified wait time, for another thread to insert it.Retrieves and removes the first element of this deque, waiting up to the specified wait time if necessary for an element to become available.Retrieves and removes the last element of this deque, waiting up to the specified wait time if necessary for an element to become available.final booleanForkJoinTask.quietlyJoin(long timeout, TimeUnit unit) Tries to join this task, returning true if it completed (possibly exceptionally) before the given timeout and the current thread has not been interrupted.final booleanForkJoinTask.quietlyJoinUninterruptibly(long timeout, TimeUnit unit) Tries to join this task, returning true if it completed (possibly exceptionally) before the given timeout.Submits a one-shot task that becomes enabled after the given delay.<V> ScheduledFuture<V> Submits a value-returning one-shot task that becomes enabled after the given delay.<V> ScheduledFuture<V> ScheduledExecutorService.scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit) Submits a periodic action that becomes enabled first after the given initial delay, and subsequently with the given period; that is, executions will commence afterinitialDelay, theninitialDelay + period, theninitialDelay + 2 * period, and so on.ScheduledThreadPoolExecutor.scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit) Submits a periodic action that becomes enabled first after the given initial delay, and subsequently with the given period; that is, executions will commence afterinitialDelay, theninitialDelay + period, theninitialDelay + 2 * period, and so on.ScheduledExecutorService.scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit) Submits 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.ScheduledThreadPoolExecutor.scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit) Submits 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.voidThreadPoolExecutor.setKeepAliveTime(long time, TimeUnit unit) Sets the thread keep-alive time, which is the amount of time that threads may remain idle before being terminated.booleanSemaphore.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.booleanSemaphore.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.booleanLinkedTransferQueue.tryTransfer(E e, long timeout, TimeUnit unit) Transfers the element to a consumer if it is possible to do so before the timeout elapses.booleanTransferQueue.tryTransfer(E e, long timeout, TimeUnit unit) Transfers the element to a consumer if it is possible to do so before the timeout elapses.Constructors in java.util.concurrent with parameters of type TimeUnitModifierConstructorDescriptionForkJoinPool(int parallelism, ForkJoinPool.ForkJoinWorkerThreadFactory factory, Thread.UncaughtExceptionHandler handler, boolean asyncMode, int corePoolSize, int maximumPoolSize, int minimumRunnable, Predicate<? super ForkJoinPool> saturate, long keepAliveTime, TimeUnit unit) Creates aForkJoinPoolwith the given parameters.ThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue) Creates a newThreadPoolExecutorwith the given initial parameters, the default thread factory and the default rejected execution handler.ThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, RejectedExecutionHandler handler) Creates a newThreadPoolExecutorwith the given initial parameters and the default thread factory.ThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, ThreadFactory threadFactory) Creates a newThreadPoolExecutorwith the given initial parameters and the default rejected execution handler.ThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, ThreadFactory threadFactory, RejectedExecutionHandler handler) Creates a newThreadPoolExecutorwith the given initial parameters. -
Uses of TimeUnit in java.util.concurrent.locks
Methods in java.util.concurrent.locks with parameters of type TimeUnitModifier and TypeMethodDescriptionfinal booleanImplements timed condition wait.final booleanImplements timed condition wait.booleanCauses the current thread to wait until it is signalled or interrupted, or the specified waiting time elapses.booleanAcquires the lock if it is free within the given waiting time and the current thread has not been interrupted.booleanAcquires the lock if it is not held by another thread within the given waiting time and the current thread has not been interrupted.booleanAcquires 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.booleanAcquires the write lock if it is not held by another thread within the given waiting time and the current thread has not been interrupted.longStampedLock.tryReadLock(long time, TimeUnit unit) Non-exclusively acquires the lock if it is available within the given time and the current thread has not been interrupted.longStampedLock.tryWriteLock(long time, TimeUnit unit) Exclusively acquires the lock if it is available within the given time and the current thread has not been interrupted. -
Uses of TimeUnit in javax.swing
Methods in javax.swing with parameters of type TimeUnit