Class ClientFutureFactory
- java.lang.Object
-
- org.apache.qpid.protonj2.client.futures.ClientFutureFactory
-
public abstract class ClientFutureFactory extends java.lang.Object
Factory for client future instances that will create specific versions based on configuration.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
BALANCED
Names a future type that uses a balanced spin then wait for the operation outcome.static java.lang.String
CONSERVATIVE
Names a future type that uses a conservative wait for the operation outcome.static java.lang.String
PROGRESSIVE
Names a future type that uses a progressive spin then wait for the operation outcome.
-
Constructor Summary
Constructors Constructor Description ClientFutureFactory()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static <T> java.util.concurrent.Future<T>
completedFuture(T result)
Creates and returns aFuture
type that is already marked completed and will return the provided result to any caller that requests the future's outcome.static ClientFutureFactory
create(java.lang.String futureType)
Create a new ClientFutureFactory instance based on the given type name.abstract <V> ClientFuture<V>
createFuture()
abstract <V> ClientFuture<V>
createFuture(ClientSynchronization<V> synchronization)
abstract <V> ClientFuture<V>
createUnfailableFuture()
abstract <V> ClientFuture<V>
createUnfailableFuture(ClientSynchronization<V> synchronization)
-
-
-
Field Detail
-
CONSERVATIVE
public static final java.lang.String CONSERVATIVE
Names a future type that uses a conservative wait for the operation outcome.- See Also:
- Constant Field Values
-
BALANCED
public static final java.lang.String BALANCED
Names a future type that uses a balanced spin then wait for the operation outcome.- See Also:
- Constant Field Values
-
PROGRESSIVE
public static final java.lang.String PROGRESSIVE
Names a future type that uses a progressive spin then wait for the operation outcome.- See Also:
- Constant Field Values
-
-
Method Detail
-
create
public static ClientFutureFactory create(java.lang.String futureType)
Create a new ClientFutureFactory instance based on the given type name.- Parameters:
futureType
- the future type whose factory should be returned.- Returns:
- a new
ClientFutureFactory
that will be used to create the desired future types.
-
completedFuture
public static <T> java.util.concurrent.Future<T> completedFuture(T result)
Creates and returns aFuture
type that is already marked completed and will return the provided result to any caller that requests the future's outcome.- Type Parameters:
T
- The type that will result from theFuture
.- Parameters:
result
- The value to return as the result of this completedFuture
.- Returns:
- the newly created completed
Future
instance.
-
createFuture
public abstract <V> ClientFuture<V> createFuture()
- Type Parameters:
V
- the eventual result type for this Future- Returns:
- a new ClientFuture instance.
-
createFuture
public abstract <V> ClientFuture<V> createFuture(ClientSynchronization<V> synchronization)
- Type Parameters:
V
- the eventual result type for this Future- Parameters:
synchronization
- TheClientSynchronization
to assign to the returnedClientFuture
.- Returns:
- a new ClientFuture instance.
-
createUnfailableFuture
public abstract <V> ClientFuture<V> createUnfailableFuture()
- Type Parameters:
V
- the eventual result type for this Future- Returns:
- a ClientFuture that treats failures as success calls that simply complete the operation.
-
createUnfailableFuture
public abstract <V> ClientFuture<V> createUnfailableFuture(ClientSynchronization<V> synchronization)
- Type Parameters:
V
- the eventual result type for this Future- Parameters:
synchronization
- TheClientSynchronization
to assign to the returnedClientFuture
.- Returns:
- a ClientFuture that treats failures as success calls that simply complete the operation.
-
-