V
- The type of the result returned by the task associated with this loader.public abstract class LoadTask<V> extends Object implements Runnable
Modifier and Type | Class and Description |
---|---|
protected class |
LoadTask.TaskFailureCallback
A basic nested class dealing with failures that can be re-used by classes extending
LoadTask . |
protected class |
LoadTask.TaskHttpErrorCallback
A basic nested class dealing with http errors that can be re-used by classes extending
LoadTask . |
Modifier and Type | Field and Description |
---|---|
protected long |
delay |
protected ScheduledFuture<?> |
future |
protected boolean |
isPeriodic |
protected String |
loaderName |
protected long |
period |
Constructor and Description |
---|
LoadTask(String loaderName,
long delay)
Creates a one-off loader.
|
LoadTask(String loaderName,
long delay,
long period)
Creates a periodic loader.
|
Modifier and Type | Method and Description |
---|---|
long |
getDefinedDelay()
Get the defined delay of this loader in milliseconds.
|
long |
getDefinedPeriod()
Get the defined period of this loader in milliseconds.
|
protected HttpErrorCallback |
getErrorCallback()
Get a default callback for an http error.
|
protected FailureCallback |
getFailureCallback()
Get a default callback to use when a failure occurs.
|
Optional<ScheduledFuture<?>> |
getFuture()
Get the future associated with the execution of this loader.
|
String |
getName()
Return the name of this loader.
|
boolean |
isPeriodic()
Return whether this loader is periodic or one-off.
|
abstract void |
run() |
String |
toString() |
protected final String loaderName
protected final long delay
protected final long period
protected final boolean isPeriodic
protected ScheduledFuture<?> future
public LoadTask(String loaderName, long delay)
loaderName
- The name of the loader.delay
- The initial delay of this loader in milliseconds.public LoadTask(String loaderName, long delay, long period)
loaderName
- The name of the loader.delay
- The initial delay of this loader in milliseconds.period
- The period of this loader in milliseconds. Zero period corresponds to a one-off loader.public String getName()
public boolean isPeriodic()
public long getDefinedDelay()
public long getDefinedPeriod()
public Optional<ScheduledFuture<?>> getFuture()
TaskScheduler
this method will return an empty Optional.protected HttpErrorCallback getErrorCallback()
protected FailureCallback getFailureCallback()
Copyright © 2016–2018 Yahoo! Inc.. All rights reserved.