@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.
-
Interface Summary Interface Description AbstractFuture.Trusted<V> Tag interface marking trusted subclasses.AsyncCallable<V> Computes a value, possibly asynchronously.AsyncFunction<I,O> Transforms a value, possibly asynchronously.CycleDetectingLockFactory.CycleDetectingLock Internal Lock implementations implement theCycleDetectingLockinterface, allowing the detection logic to treat all locks in the same manner.CycleDetectingLockFactory.Policy Encapsulates the action to be taken when a potential deadlock is encountered.FutureCallback<V> A callback for accepting the results of aFuturecomputation asynchronously.FuturesGetChecked.GetCheckedTypeValidator ListenableFuture<V> AFuturethat accepts completion listeners.ListenableScheduledFuture<V> Helper interface to implement bothListenableFutureandScheduledFuture.ListenerCallQueue.Event<L> Method reference-compatible listener event.ListeningExecutorService AnExecutorServicethat returnsListenableFutureinstances.ListeningScheduledExecutorService AScheduledExecutorServicethat returnsListenableFutureinstances from itsExecutorServicemethods.Service An object with an operational state, plus asynchronousService.startAsync()andService.stopAsync()lifecycle methods to transition between states.TimeLimiter Imposes a time limit on method calls. -
Class Summary Class Description AbstractCatchingFuture<V,X extends java.lang.Throwable,F,T> Implementations ofFutures.catching*.AbstractCatchingFuture.AsyncCatchingFuture<V,X extends java.lang.Throwable> AnAbstractCatchingFuturethat delegates to anAsyncFunctionandAbstractFuture.setFuture(ListenableFuture).AbstractCatchingFuture.CatchingFuture<V,X extends java.lang.Throwable> AbstractExecutionThreadService Base class for services that can implementAbstractExecutionThreadService.startUp(),AbstractExecutionThreadService.run()andAbstractExecutionThreadService.shutDown()methods.AbstractFuture<V> An abstract implementation ofListenableFuture, intended for advanced users only.AbstractFuture.AtomicHelper AbstractFuture.Cancellation A special value to represent cancellation and the 'wasInterrupted' bit.AbstractFuture.Failure A special value to represent failure, whenAbstractFuture.setException(java.lang.Throwable)is called successfully.AbstractFuture.Listener Listeners also form a stack through theAbstractFuture.listenersfield.AbstractFuture.SafeAtomicHelper AbstractFuture.AtomicHelperbased onAtomicReferenceFieldUpdater.AbstractFuture.SetFuture<V> A special value that encodes the 'setFuture' state.AbstractFuture.SynchronizedHelper AbstractFuture.AtomicHelperbased onsynchronizedand volatile writes.AbstractFuture.TrustedFuture<V> A less abstract subclass of AbstractFuture.AbstractFuture.UnsafeAtomicHelper AbstractFuture.AtomicHelperbased onUnsafe.AbstractFuture.Waiter Waiter links form a Treiber stack, in theAbstractFuture.waitersfield.AbstractIdleService Base class for services that do not need a thread while "running" but may need one during startup and shutdown.AbstractListeningExecutorService AbstractListeningExecutorServiceimplementation that createsListenableFutureinstances for eachRunnableandCallablesubmitted to it.AbstractScheduledService Base class for services that can implementAbstractScheduledService.startUp()andAbstractScheduledService.shutDown()but while in the "running" state need to perform a periodic task.AbstractScheduledService.CustomScheduler AAbstractScheduledService.Schedulerthat provides a convenient way for theAbstractScheduledServiceto use a dynamically changing schedule.AbstractScheduledService.CustomScheduler.Schedule A value object that represents an absolute delay until a task should be invoked.AbstractScheduledService.Scheduler A scheduler defines the policy for how theAbstractScheduledServiceshould run its task.AbstractService Base class for implementing services that can handleAbstractService.doStart()andAbstractService.doStop()requests, responding to them withAbstractService.notifyStarted()andAbstractService.notifyStopped()callbacks.AbstractService.StateSnapshot An immutable snapshot of the current state of the service.AbstractTransformFuture<I,O,F,T> Implementations ofFutures.transform*.AbstractTransformFuture.AsyncTransformFuture<I,O> AnAbstractTransformFuturethat delegates to anAsyncFunctionandAbstractFuture.setFuture(ListenableFuture).AbstractTransformFuture.TransformFuture<I,O> AggregateFuture<InputT,OutputT> A future made up of a collection of sub-futures.AggregateFutureState A helper which does some thread-safe operations for aggregate futures, which must be implemented differently in GWT.AggregateFutureState.AtomicHelper AggregateFutureState.SafeAtomicHelper AggregateFutureState.SynchronizedAtomicHelper AtomicDouble Adoublevalue that may be updated atomically.AtomicDoubleArray Adoublearray in which elements may be updated atomically.AtomicLongMap<K> A map containinglongvalues that can be atomically updated.Atomics Static utility methods pertaining to classes in thejava.util.concurrent.atomicpackage.Callables Static utility methods pertaining to theCallableinterface.CollectionFuture<V,C> Aggregate future that collects (stores) results of each future.CollectionFuture.ListFuture<V> CombinedFuture<V> Aggregate future that computes its value by calling a callable.CycleDetectingLockFactory TheCycleDetectingLockFactorycreatesReentrantLockinstances andReentrantReadWriteLockinstances that detect potential deadlock by checking for cycles in lock acquisition order.CycleDetectingLockFactory.LockGraphNode ALockGraphNodeassociated with each lock instance keeps track of the directed edges in the lock acquisition graph.CycleDetectingLockFactory.WithExplicitOrdering<E extends java.lang.Enum<E>> ACycleDetectingLockFactory.WithExplicitOrderingprovides the additional enforcement of an application-specified ordering of lock acquisitions.ExecutionList A support class forListenableFutureimplementations to manage their listeners.ExecutionList.RunnableExecutorPair ExecutionSequencer Serializes execution of a set of operations.FakeTimeLimiter A TimeLimiter implementation which actually does not attempt to limit time at all.FluentFuture<V> AListenableFuturethat supports fluent chains of operations.FluentFuture.TrustedFuture<V> A less abstract subclass of AbstractFuture.ForwardingBlockingDeque<E> ABlockingDequewhich forwards all its method calls to anotherBlockingDeque.ForwardingBlockingQueue<E> ABlockingQueuewhich forwards all its method calls to anotherBlockingQueue.ForwardingCondition Forwarding wrapper around aCondition.ForwardingExecutorService An executor service which forwards all its method calls to another executor service.ForwardingFluentFuture<V> FluentFuturethat forwards all calls to a delegate.ForwardingFuture<V> AFuturewhich forwards all its method calls to another future.ForwardingFuture.SimpleForwardingFuture<V> A simplified version ofForwardingFuturewhere subclasses can pass in an already constructedFutureas the delegate.ForwardingListenableFuture<V> AListenableFuturewhich forwards all its method calls to another future.ForwardingListenableFuture.SimpleForwardingListenableFuture<V> A simplified version ofForwardingListenableFuturewhere subclasses can pass in an already constructedListenableFutureas the delegate.ForwardingListeningExecutorService A listening executor service which forwards all its method calls to another listening executor service.ForwardingLock Forwarding wrapper around aLock.Futures Static utility methods pertaining to theFutureinterface.Futures.CallbackListener<V> SeeFutures.addCallback(ListenableFuture, FutureCallback, Executor)for behavioral notes.Futures.FutureCombiner<V> A helper to create a newListenableFuturewhose result is generated from a combination of input futures.Futures.InCompletionOrderFuture<T> Futures.InCompletionOrderState<T> Futures.NonCancellationPropagatingFuture<V> A wrapped future that does not propagate cancellation to its delegate.FuturesGetChecked Static methods used to implementFutures.getChecked(Future, Class).FuturesGetChecked.GetCheckedTypeValidatorHolder Provides a check of whether an exception type is valid for use withFuturesGetChecked.getChecked(Future, Class), possibly using caching.GwtFluentFutureCatchingSpecialization<V> Hidden superclass ofFluentFuturethat provides us a place to declare special GWT versions of theFluentFuture.catchingfamily of methods.GwtFuturesCatchingSpecialization Hidden superclass ofFuturesthat provides us a place to declare special GWT versions of theFutures.catchingfamily of methods.ImmediateFuture<V> Implementations ofFutures.immediate*.ImmediateFuture.ImmediateCancelledFuture<V> ImmediateFuture.ImmediateFailedFuture<V> ImmediateFuture.ImmediateSuccessfulFuture<V> Internal This class is forcom.google.common.util.concurrentuse only!InterruptibleTask<T> InterruptibleTask.DoNothingRunnable JdkFutureAdapters Utilities necessary for working with libraries that supply plainFutureinstances.JdkFutureAdapters.ListenableFutureAdapter<V> An adapter to turn aFutureinto aListenableFuture.ListenableFutureTask<V> AFutureTaskthat also implements theListenableFutureinterface.ListenerCallQueue<L> A list of listeners for implementing a concurrency friendly observable object.ListenerCallQueue.PerListenerQueue<L> A special purpose queue/executor that dispatches listener events serially on a configured executor.Monitor A synchronization abstraction supporting waiting on arbitrary boolean conditions.Monitor.Guard A boolean condition for which a thread may wait.MoreExecutors Factory and utility methods forExecutor,ExecutorService, andThreadFactory.MoreExecutors.Application Represents the current application to register shutdown hooks.MoreExecutors.DirectExecutorService MoreExecutors.ListeningDecorator MoreExecutors.ScheduledListeningDecorator MoreExecutors.ScheduledListeningDecorator.ListenableScheduledTask<V> MoreExecutors.ScheduledListeningDecorator.NeverSuccessfulListenableFutureTask Partially Outer class that exists solely to let us writePartially.GwtIncompatibleinstead of plainGwtIncompatible.Platform Methods factored out so that they can be emulated differently in GWT.RateLimiter A rate limiter.RateLimiter.SleepingStopwatch Runnables Static utility methods pertaining to theRunnableinterface.SequentialExecutor Executor ensuring that all Runnables submitted are executed in order, using the provided Executor, and sequentially such that no two will ever be running at the same time.Service.Listener A listener for the various state changes that aServicegoes through in its lifecycle.ServiceManager A manager for monitoring and controlling a set of services.ServiceManager.EmptyServiceManagerWarning This is never thrown but only used for logging.ServiceManager.FailedService ServiceManager.Listener A listener for the aggregate state changes of the services that are under management.ServiceManager.NoOpService AServiceinstance that does nothing.ServiceManager.ServiceListener AServicethat wraps another service and times how long it takes for it to start and also calls theServiceManager.ServiceManagerState.transitionService(Service, State, State), to record the state transitions.ServiceManager.ServiceManagerState An encapsulation of all the mutable state of theServiceManagerthat needs to be accessed by instances ofServiceManager.ServiceListener.SettableFuture<V> AListenableFuturewhose result can be set by aSettableFuture.set(Object),SettableFuture.setException(Throwable)orSettableFuture.setFuture(ListenableFuture)call.SimpleTimeLimiter A TimeLimiter that runs method calls in the background using anExecutorService.SmoothRateLimiter SmoothRateLimiter.SmoothBursty This implements a "bursty" RateLimiter, where storedPermits are translated to zero throttling.SmoothRateLimiter.SmoothWarmingUp This implements the following function where coldInterval = coldFactor * stableInterval.Striped<L> A stripedLock/Semaphore/ReadWriteLock.Striped.CompactStriped<L> Implementation of Striped where 2^k stripes are represented as an array of the same length, eagerly initialized.Striped.LargeLazyStriped<L> Implementation of Striped where up to 2^k stripes can be represented, using a ConcurrentMap where the key domain is [0..2^k).Striped.PaddedLock Striped.PaddedSemaphore Striped.PowerOfTwoStriped<L> Striped.SmallLazyStriped<L> Implementation of Striped where up to 2^k stripes can be represented, using an AtomicReferenceArray of size 2^k.Striped.SmallLazyStriped.ArrayReference<L> Striped.WeakSafeCondition Condition object that ensures a strong reference is retained to a specified object.Striped.WeakSafeLock Lock object that ensures a strong reference is retained to a specified object.Striped.WeakSafeReadWriteLock ReadWriteLock implementation whose read and write locks retain a reference back to this lock.ThreadFactoryBuilder 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 factoryTimeoutFuture<V> Implementation ofFutures#withTimeout.TimeoutFuture.Fire<V> A runnable that is called when the delegate or the timer completes.TrustedListenableFutureTask<V> ARunnableFuturethat also implements theListenableFutureinterface.UncaughtExceptionHandlers Factories forThread.UncaughtExceptionHandlerinstances.UncaughtExceptionHandlers.Exiter Uninterruptibles Utilities for treating interruptible operations as uninterruptible.WrappingExecutorService An abstractExecutorServicethat allows subclasses to wrap tasks before they are submitted to the underlying executor.WrappingScheduledExecutorService An abstractScheduledExecutorServicethat allows subclasses to wrap tasks before they are submitted to the underlying executor. -
Enum Summary Enum Description CycleDetectingLockFactory.Policies Pre-definedCycleDetectingLockFactory.Policyimplementations.DirectExecutor AnExecutorthat runs each task in the thread that invokesexecute.ExecutionSequencer.RunningState FuturesGetChecked.GetCheckedTypeValidatorHolder.ClassValueValidator FuturesGetChecked.GetCheckedTypeValidatorHolder.WeakSetValidator SequentialExecutor.WorkerRunningState Service.State The lifecycle states of a service. -
Exception Summary Exception Description CycleDetectingLockFactory.ExampleStackTrace A Throwable used to record a stack trace that illustrates an example of a specific lock acquisition ordering.CycleDetectingLockFactory.PotentialDeadlockException Represents a detected cycle in lock acquisition ordering.TimeoutFuture.TimeoutFutureException UncheckedExecutionException Unchecked variant ofExecutionException.UncheckedTimeoutException Unchecked version ofTimeoutException. -
Error Summary Error Description ExecutionError Errorvariant ofExecutionException. -
Annotation Types Summary Annotation Type Description Partially.GwtIncompatible The presence of this annotation on an API indicates that the method may be used with the Google Web Toolkit (GWT) but that it has some restrictions.