Class LoggingScheduledFuture<V>
java.lang.Object
de.aristaflow.adept2.util.threading.LoggingFuture<V>
de.aristaflow.adept2.util.threading.LoggingScheduledFuture<V>
- Type Parameters:
V- The result type returned by this Future'sgetmethod.
- All Implemented Interfaces:
Comparable<Delayed>,Runnable,Delayed,Future<V>,RunnableFuture<V>,RunnableScheduledFuture<V>,ScheduledFuture<V>
public class LoggingScheduledFuture<V>
extends LoggingFuture<V>
implements RunnableScheduledFuture<V>
A scheduled future that wraps another future and logs all occurred exceptions
and the result for information purpose if no one was interested in it.
- Author:
- Ulrich Kreher
-
Nested Class Summary
Nested classes/interfaces inherited from class de.aristaflow.adept2.util.threading.LoggingFuture
LoggingFuture.IgnoredResultLogger -
Field Summary
Fields inherited from class de.aristaflow.adept2.util.threading.LoggingFuture
cleanup, logger, resultRelevant -
Constructor Summary
ConstructorsConstructorDescriptionLoggingScheduledFuture(RunnableScheduledFuture<V> future, boolean resultRelevant, Logger logger) Creates a new future wrapping the designatedRunnableScheduledFuturelogging the outcome of the future if no one has retrieved it. -
Method Summary
Modifier and TypeMethodDescriptionbooleancancel(boolean mayInterruptIfRunning) intlongprotected RunnableScheduledFuture<V>Gets the wrapped future runnable.booleanMethods inherited from class de.aristaflow.adept2.util.threading.LoggingFuture
equals, get, get, hashCode, isCancelled, isDone, runMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.concurrent.Future
get, get, isCancelled, isDoneMethods inherited from interface java.util.concurrent.RunnableFuture
run
-
Constructor Details
-
LoggingScheduledFuture
public LoggingScheduledFuture(RunnableScheduledFuture<V> future, boolean resultRelevant, Logger logger) Creates a new future wrapping the designatedRunnableScheduledFuturelogging the outcome of the future if no one has retrieved it.- Parameters:
future- TheRunnableScheduledFuturewhich 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.
-
-
Method Details
-
getWrappedFutureRunnable
Description copied from class:LoggingFutureGets the wrapped future runnable. This is useful for subclasses requiring a more specific object.- Overrides:
getWrappedFutureRunnablein classLoggingFuture<V>- Returns:
- The wrapped future runnable.
-
getDelay
-
isPeriodic
public boolean isPeriodic()- Specified by:
isPeriodicin interfaceRunnableScheduledFuture<V>
-
cancel
public boolean cancel(boolean mayInterruptIfRunning) -
compareTo
- Specified by:
compareToin interfaceComparable<V>
-