Package com.google.common.util.concurrent
@CheckReturnValue
@ParametersAreNonnullByDefault
package com.google.common.util.concurrent
Concurrency utilities.
Commonly used types include ListenableFuture
and
Service
.
Commonly used utilities include Futures
,
MoreExecutors
, and
ThreadFactoryBuilder
.
This package is a part of the open-source Guava library.
-
ClassDescriptionAbstractCheckedFuture<V,
X extends Exception> A delegating wrapper around aListenableFuture
that adds support for theAbstractCheckedFuture.checkedGet()
andAbstractCheckedFuture.checkedGet(long, TimeUnit)
methods.Base class for services that can implementAbstractExecutionThreadService.startUp()
,AbstractExecutionThreadService.run()
andAbstractExecutionThreadService.shutDown()
methods.An abstract implementation ofListenableFuture
, intended for advanced users only.Base class for services that do not need a thread while "running" but may need one during startup and shutdown.AbstractListeningExecutorService
implementation that createsListenableFuture
instances for eachRunnable
andCallable
submitted to it.Base class for services that can implementAbstractScheduledService.startUp()
andAbstractScheduledService.shutDown()
but while in the "running" state need to perform a periodic task.AAbstractScheduledService.Scheduler
that provides a convenient way for theAbstractScheduledService
to use a dynamically changing schedule.A value object that represents an absolute delay until a task should be invoked.A scheduler defines the policy for how theAbstractScheduledService
should run its task.Base class for implementing services that can handleAbstractService.doStart()
andAbstractService.doStop()
requests, responding to them withAbstractService.notifyStarted()
andAbstractService.notifyStopped()
callbacks.Computes a value, possibly asynchronously.AsyncFunction<I,O> Transforms a value, possibly asynchronously.Adouble
value that may be updated atomically.Adouble
array in which elements may be updated atomically.A map containinglong
values that can be atomically updated.Static utility methods pertaining to classes in thejava.util.concurrent.atomic
package.Static utility methods pertaining to theCallable
interface.CheckedFuture<V,X extends Exception> ACheckedFuture
is aListenableFuture
that includes versions of theget
methods that can throw a checked exception.TheCycleDetectingLockFactory
createsReentrantLock
instances andReentrantReadWriteLock
instances that detect potential deadlock by checking for cycles in lock acquisition order.Pre-definedCycleDetectingLockFactory.Policy
implementations.Encapsulates the action to be taken when a potential deadlock is encountered.Represents a detected cycle in lock acquisition ordering.CycleDetectingLockFactory.WithExplicitOrdering<E extends Enum<E>>ACycleDetectingLockFactory.WithExplicitOrdering
provides the additional enforcement of an application-specified ordering of lock acquisitions.Error
variant ofExecutionException
.A support class forListenableFuture
implementations to manage their listeners.A TimeLimiter implementation which actually does not attempt to limit time at all.ABlockingQueue
which forwards all its method calls to anotherBlockingQueue
.ForwardingCheckedFuture<V,X extends Exception> A future which forwards all its method calls to another future.A simplified version ofForwardingCheckedFuture
where subclasses can pass in an already constructedCheckedFuture
as the delegate.An executor service which forwards all its method calls to another executor service.AFuture
which forwards all its method calls to another future.A simplified version ofForwardingFuture
where subclasses can pass in an already constructedFuture
as the delegate.AListenableFuture
which forwards all its method calls to another future.A simplified version ofForwardingListenableFuture
where subclasses can pass in an already constructedListenableFuture
as the delegate.A listening executor service which forwards all its method calls to another listening executor service.A callback for accepting the results of aFuture
computation asynchronously.Static utility methods pertaining to theFuture
interface.A helper to create a newListenableFuture
whose result is generated from a combination of input futures.Utilities necessary for working with libraries that supply plainFuture
instances.AFuture
that accepts completion listeners.AFutureTask
that also implements theListenableFuture
interface.Helper interface to implement bothListenableFuture
andScheduledFuture
.AnExecutorService
that returnsListenableFuture
instances.AScheduledExecutorService
that returnsListenableFuture
instances from itsExecutorService
methods.A synchronization abstraction supporting waiting on arbitrary boolean conditions.A boolean condition for which a thread may wait.A rate limiter.Static utility methods pertaining to theRunnable
interface.An object with an operational state, plus asynchronousService.startAsync()
andService.stopAsync()
lifecycle methods to transition between states.A listener for the various state changes that aService
goes through in its lifecycle.The lifecycle states of a service.A manager for monitoring and controlling a set of services.A listener for the aggregate state changes of the services that are under management.AListenableFuture
whose result can be set by aSettableFuture.set(Object)
,SettableFuture.setException(Throwable)
orSettableFuture.setFuture(ListenableFuture)
call.A TimeLimiter that runs method calls in the background using anExecutorService
.Striped<L>A stripedLock/Semaphore/ReadWriteLock
.A ThreadFactory builder, providing any combination of these features: whether threads should be marked as daemon threads a naming format a thread priority an uncaught exception handler a backing thread factoryProduces proxies that impose a time limit on method calls to the proxied object.Factories forThread.UncaughtExceptionHandler
instances.Unchecked variant ofExecutionException
.Unchecked version ofTimeoutException
.Utilities for treating interruptible operations as uninterruptible.