Package org.minidns
Class MiniDnsFuture<V,E extends java.lang.Exception>
- java.lang.Object
-
- org.minidns.MiniDnsFuture<V,E>
-
- All Implemented Interfaces:
java.util.concurrent.Future<V>
,CallbackRecipient<V,E>
- Direct Known Subclasses:
MiniDnsFuture.InternalMiniDnsFuture
public abstract class MiniDnsFuture<V,E extends java.lang.Exception> extends java.lang.Object implements java.util.concurrent.Future<V>, CallbackRecipient<V,E>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
MiniDnsFuture.ExceptionsWrapper<EI extends java.lang.Exception,EO extends java.lang.Exception>
static class
MiniDnsFuture.InternalMiniDnsFuture<V,E extends java.lang.Exception>
-
Constructor Summary
Constructors Constructor Description MiniDnsFuture()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <V,EI extends java.lang.Exception,EO extends java.lang.Exception>
MiniDnsFuture<V,EO>anySuccessfulOf(java.util.Collection<MiniDnsFuture<V,EI>> futures, MiniDnsFuture.ExceptionsWrapper<EI,EO> exceptionsWrapper)
static <V> MiniDnsFuture<V,java.io.IOException>
anySuccessfulOf(java.util.Collection<MiniDnsFuture<V,java.io.IOException>> futures)
boolean
cancel(boolean mayInterruptIfRunning)
static <V,E extends java.lang.Exception>
MiniDnsFuture<V,E>from(V result)
V
get()
V
get(long timeout, java.util.concurrent.TimeUnit unit)
V
getOrThrow()
boolean
hasException()
boolean
hasResult()
boolean
isCancelled()
boolean
isDone()
protected void
maybeInvokeCallbacks()
CallbackRecipient<V,E>
onError(ExceptionCallback<E> exceptionCallback)
CallbackRecipient<V,E>
onSuccess(SuccessCallback<V> successCallback)
-
-
-
Constructor Detail
-
MiniDnsFuture
public MiniDnsFuture()
-
-
Method Detail
-
cancel
public boolean cancel(boolean mayInterruptIfRunning)
- Specified by:
cancel
in interfacejava.util.concurrent.Future<V>
-
isCancelled
public final boolean isCancelled()
- Specified by:
isCancelled
in interfacejava.util.concurrent.Future<V>
-
isDone
public final boolean isDone()
- Specified by:
isDone
in interfacejava.util.concurrent.Future<V>
-
hasResult
public final boolean hasResult()
-
hasException
public final boolean hasException()
-
onSuccess
public CallbackRecipient<V,E> onSuccess(SuccessCallback<V> successCallback)
- Specified by:
onSuccess
in interfaceCallbackRecipient<V,E extends java.lang.Exception>
-
onError
public CallbackRecipient<V,E> onError(ExceptionCallback<E> exceptionCallback)
- Specified by:
onError
in interfaceCallbackRecipient<V,E extends java.lang.Exception>
-
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
-
getOrThrow
public final V getOrThrow() throws E extends java.lang.Exception
- Throws:
E extends java.lang.Exception
-
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
-
maybeInvokeCallbacks
protected final void maybeInvokeCallbacks()
-
from
public static <V,E extends java.lang.Exception> MiniDnsFuture<V,E> from(V result)
-
anySuccessfulOf
public static <V> MiniDnsFuture<V,java.io.IOException> anySuccessfulOf(java.util.Collection<MiniDnsFuture<V,java.io.IOException>> futures)
-
anySuccessfulOf
public static <V,EI extends java.lang.Exception,EO extends java.lang.Exception> MiniDnsFuture<V,EO> anySuccessfulOf(java.util.Collection<MiniDnsFuture<V,EI>> futures, MiniDnsFuture.ExceptionsWrapper<EI,EO> exceptionsWrapper)
-
-