Package net.toddm.comm
Class NoResponseFuture
- java.lang.Object
-
- java.util.concurrent.FutureTask<Response>
-
- net.toddm.comm.NoResponseFuture
-
- All Implemented Interfaces:
Runnable,Future<Response>,RunnableFuture<Response>
public class NoResponseFuture extends FutureTask<Response>
This is a simple no-opFutureTaskimplementation that simply returns a nullResponse. We provide this wrapping so that no special case code is ever required. Client code can still be written to, for example, block on future get() wait handles. In this case no result null is simply returned immediately.- Author:
- Todd S. Murchison
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedNoResponseFuture()Constructors aFutureTaskinstance that always immediately returns null.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Responseget()Immediately returns null.Responseget(long timeout, TimeUnit unit)Immediately returns null.booleanisCancelled()Always returns FALSE.booleanisDone()Always returns TRUE.voidrun()Does nothing.-
Methods inherited from class java.util.concurrent.FutureTask
cancel, done, runAndReset, set, setException, toString
-
-
-
-
Constructor Detail
-
NoResponseFuture
protected NoResponseFuture()
Constructors aFutureTaskinstance that always immediately returns null.
-
-
Method Detail
-
get
public Response get()
Immediately returns null.
-
isCancelled
public boolean isCancelled()
Always returns FALSE.- Specified by:
isCancelledin interfaceFuture<Response>- Overrides:
isCancelledin classFutureTask<Response>
-
isDone
public boolean isDone()
Always returns TRUE.
-
run
public void run()
Does nothing.- Specified by:
runin interfaceRunnable- Specified by:
runin interfaceRunnableFuture<Response>- Overrides:
runin classFutureTask<Response>
-
-