Package com.linkedin.alpini.base.misc
Class PromiseDelegate<V>
- java.lang.Object
-
- com.linkedin.alpini.base.misc.PromiseDelegate<V>
-
- Type Parameters:
V
- promise type
- All Implemented Interfaces:
io.netty.util.concurrent.Future<V>
,io.netty.util.concurrent.Promise<V>
,java.util.concurrent.Future<V>
public class PromiseDelegate<V> extends java.lang.Object implements io.netty.util.concurrent.Promise<V>
A simple delegate class which wraps an existingPromise
and permits overriding of some of its methods.
-
-
Constructor Summary
Constructors Constructor Description PromiseDelegate(io.netty.util.concurrent.Promise<V> promise)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description io.netty.util.concurrent.Promise<V>
addListener(io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super V>> listener)
io.netty.util.concurrent.Promise<V>
addListeners(io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super V>>... listeners)
io.netty.util.concurrent.Promise<V>
await()
boolean
await(long timeoutMillis)
boolean
await(long timeout, java.util.concurrent.TimeUnit unit)
io.netty.util.concurrent.Promise<V>
awaitUninterruptibly()
boolean
awaitUninterruptibly(long timeoutMillis)
boolean
awaitUninterruptibly(long timeout, java.util.concurrent.TimeUnit unit)
boolean
cancel(boolean mayInterruptIfRunning)
java.lang.Throwable
cause()
V
get()
V
get(long timeout, java.util.concurrent.TimeUnit unit)
V
getNow()
boolean
isCancellable()
boolean
isCancelled()
boolean
isDone()
boolean
isSuccess()
io.netty.util.concurrent.Promise<V>
removeListener(io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super V>> listener)
io.netty.util.concurrent.Promise<V>
removeListeners(io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super V>>... listeners)
io.netty.util.concurrent.Promise<V>
setFailure(java.lang.Throwable cause)
io.netty.util.concurrent.Promise<V>
setSuccess(V result)
boolean
setUncancellable()
io.netty.util.concurrent.Promise<V>
sync()
io.netty.util.concurrent.Promise<V>
syncUninterruptibly()
boolean
tryFailure(java.lang.Throwable cause)
boolean
trySuccess(V result)
-
-
-
Constructor Detail
-
PromiseDelegate
public PromiseDelegate(io.netty.util.concurrent.Promise<V> promise)
-
-
Method Detail
-
setSuccess
public final io.netty.util.concurrent.Promise<V> setSuccess(V result)
- Specified by:
setSuccess
in interfaceio.netty.util.concurrent.Promise<V>
-
trySuccess
public boolean trySuccess(V result)
- Specified by:
trySuccess
in interfaceio.netty.util.concurrent.Promise<V>
-
setFailure
public final io.netty.util.concurrent.Promise<V> setFailure(java.lang.Throwable cause)
- Specified by:
setFailure
in interfaceio.netty.util.concurrent.Promise<V>
-
tryFailure
public boolean tryFailure(java.lang.Throwable cause)
- Specified by:
tryFailure
in interfaceio.netty.util.concurrent.Promise<V>
-
setUncancellable
public boolean setUncancellable()
- Specified by:
setUncancellable
in interfaceio.netty.util.concurrent.Promise<V>
-
isSuccess
public boolean isSuccess()
- Specified by:
isSuccess
in interfaceio.netty.util.concurrent.Future<V>
-
isCancellable
public final boolean isCancellable()
- Specified by:
isCancellable
in interfaceio.netty.util.concurrent.Future<V>
-
cause
public final java.lang.Throwable cause()
- Specified by:
cause
in interfaceio.netty.util.concurrent.Future<V>
-
addListener
public io.netty.util.concurrent.Promise<V> addListener(io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super V>> listener)
-
addListeners
public io.netty.util.concurrent.Promise<V> addListeners(io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super V>>... listeners)
-
removeListener
public io.netty.util.concurrent.Promise<V> removeListener(io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super V>> listener)
-
removeListeners
public io.netty.util.concurrent.Promise<V> removeListeners(io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super V>>... listeners)
-
await
public io.netty.util.concurrent.Promise<V> await() throws java.lang.InterruptedException
-
awaitUninterruptibly
public io.netty.util.concurrent.Promise<V> awaitUninterruptibly()
-
await
public boolean await(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
- Specified by:
await
in interfaceio.netty.util.concurrent.Future<V>
- Throws:
java.lang.InterruptedException
-
await
public boolean await(long timeoutMillis) throws java.lang.InterruptedException
- Specified by:
await
in interfaceio.netty.util.concurrent.Future<V>
- Throws:
java.lang.InterruptedException
-
awaitUninterruptibly
public boolean awaitUninterruptibly(long timeout, java.util.concurrent.TimeUnit unit)
- Specified by:
awaitUninterruptibly
in interfaceio.netty.util.concurrent.Future<V>
-
awaitUninterruptibly
public boolean awaitUninterruptibly(long timeoutMillis)
- Specified by:
awaitUninterruptibly
in interfaceio.netty.util.concurrent.Future<V>
-
cancel
public boolean cancel(boolean mayInterruptIfRunning)
-
isCancelled
public boolean isCancelled()
- Specified by:
isCancelled
in interfacejava.util.concurrent.Future<V>
-
isDone
public boolean isDone()
- Specified by:
isDone
in interfacejava.util.concurrent.Future<V>
-
get
public final V get() throws java.lang.InterruptedException, java.util.concurrent.ExecutionException
- Specified by:
get
in interfacejava.util.concurrent.Future<V>
- Throws:
java.lang.InterruptedException
java.util.concurrent.ExecutionException
-
get
public final V get(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException, java.util.concurrent.TimeoutException
- Specified by:
get
in interfacejava.util.concurrent.Future<V>
- Throws:
java.lang.InterruptedException
java.util.concurrent.ExecutionException
java.util.concurrent.TimeoutException
-
sync
public final io.netty.util.concurrent.Promise<V> sync() throws java.lang.InterruptedException
-
-