javadoc.com.google.common.util.concurrent.JdkFutureAdapters.html Maven / Gradle / Ivy
JdkFutureAdapters (Guava: Google Core Libraries for Java 11.0.1 API)
Overview
Package
Class
Use
Tree
Deprecated
Index
Help
PREV CLASS
NEXT CLASS
FRAMES
NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD
DETAIL: FIELD | CONSTR | METHOD
com.google.common.util.concurrent
Class JdkFutureAdapters
java.lang.Object
com.google.common.util.concurrent.JdkFutureAdapters
@Beta
public final class JdkFutureAdapters
- extends Object
Utilities necessary for working with libraries that supply plain Future
instances. Note that, whenver possible, it is strongly preferred to
modify those libraries to return ListenableFuture
directly.
- Since:
- 10.0 (replacing
Futures.makeListenable
, which existed in 1.0) - Author:
- Sven Mawson
Method Summary | ||
---|---|---|
static
|
listenInPoolThread(Future<V> future)
Assigns a thread to the given Future to provide ListenableFuture functionality. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
listenInPoolThread
public static <V> ListenableFuture<V> listenInPoolThread(Future<V> future)
- Assigns a thread to the given
Future
to provideListenableFuture
functionality.Warning: If the input future does not already implement
ListenableFuture
, the returned future will emulateListenableFuture.addListener(java.lang.Runnable, java.util.concurrent.Executor)
by taking a thread from an internal, unbounded pool at the first call toaddListener
and holding it until the future is done.Prefer to create
ListenableFuture
instances withSettableFuture
,MoreExecutors.listeningDecorator( java.util.concurrent.ExecutorService)
,ListenableFutureTask
,AbstractFuture
, and other utilities over creating plainFuture
instances to be upgraded toListenableFuture
after the fact.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 2010-2012. All Rights Reserved.