V - The result type returned by this Future's get method.public class LoggingFuture<V>
extends java.lang.Object
implements java.util.concurrent.RunnableFuture<V>
| Modifier and Type | Field and Description |
|---|---|
protected java.util.logging.Logger |
logger
The logger for logging unhandled results, Exception, RuntimeException
or Error.
|
protected boolean |
resultRelevant
Whether the result of the future is relevant and therefore it should be
logged if it is not retrieved.
|
| Constructor and Description |
|---|
LoggingFuture(java.util.concurrent.RunnableFuture<V> future,
boolean resultRelevant,
java.util.logging.Logger logger)
Creates a new future wrapping the designated
RunnableFuture
logging the outcome of the future if no one has retrieved it. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
cancel(boolean mayInterruptIfRunning) |
boolean |
equals(java.lang.Object other) |
protected void |
finalize() |
V |
get() |
V |
get(long timeout,
java.util.concurrent.TimeUnit unit) |
protected java.util.concurrent.RunnableFuture<V> |
getWrappedFutureRunnable()
Gets the wrapped future runnable.
|
int |
hashCode() |
boolean |
isCancelled() |
boolean |
isDone() |
void |
run() |
protected final boolean resultRelevant
protected java.util.logging.Logger logger
public LoggingFuture(java.util.concurrent.RunnableFuture<V> future, boolean resultRelevant, java.util.logging.Logger logger)
RunnableFuture
logging the outcome of the future if no one has retrieved it.future - The RunnableFuture which to wrap.resultRelevant - Whether the result of the future is relevant and
therefore it should be logged if it is not retrieved.logger - The logger for logging unhandled results, Exception,
RuntimeException or Error.protected void finalize()
finalize in class java.lang.Objectprotected java.util.concurrent.RunnableFuture<V> getWrappedFutureRunnable()
public void run()
run in interface java.lang.Runnablerun in interface java.util.concurrent.RunnableFuture<V>public boolean cancel(boolean mayInterruptIfRunning)
cancel in interface java.util.concurrent.Future<V>public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object other)
equals in class java.lang.Objectpublic boolean isCancelled()
isCancelled in interface java.util.concurrent.Future<V>public boolean isDone()
isDone in interface java.util.concurrent.Future<V>public V get() throws java.lang.InterruptedException, java.util.concurrent.ExecutionException
get in interface java.util.concurrent.Future<V>java.lang.InterruptedExceptionjava.util.concurrent.ExecutionExceptionpublic V get(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException, java.util.concurrent.TimeoutException
get in interface java.util.concurrent.Future<V>java.lang.InterruptedExceptionjava.util.concurrent.ExecutionExceptionjava.util.concurrent.TimeoutException