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
Constructors Constructor Description 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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancancel(boolean mayInterruptIfRunning)intcompareTo(Delayed o)longgetDelay(TimeUnit unit)protected RunnableScheduledFuture<V>getWrappedFutureRunnable()Gets the wrapped future runnable.booleanisPeriodic()-
Methods inherited from class de.aristaflow.adept2.util.threading.LoggingFuture
equals, get, get, hashCode, isCancelled, isDone, run
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.concurrent.Future
get, get, isCancelled, isDone
-
Methods inherited from interface java.util.concurrent.RunnableFuture
run
-
-
-
-
Constructor Detail
-
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 Detail
-
getWrappedFutureRunnable
protected RunnableScheduledFuture<V> 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.
-
isPeriodic
public boolean isPeriodic()
- Specified by:
isPeriodicin interfaceRunnableScheduledFuture<V>
-
cancel
public boolean cancel(boolean mayInterruptIfRunning)
-
compareTo
public int compareTo(Delayed o)
- Specified by:
compareToin interfaceComparable<V>
-
-