|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectTask.AbstractTask
Task.NetworkTask<ReturnValueType>
Task.RecurringNetworkTask<ReturnValueType>
public class RecurringNetworkTask<ReturnValueType>
This task is a subclass of NetworkTask.
It adds the abillty to perform recurring tasks on top of the implementation of
NetworkTask.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class Task.AbstractTask |
|---|
AbstractTask.PropertyNames, AbstractTask.State, AbstractTask.Type |
| Field Summary | |
|---|---|
protected java.util.concurrent.ScheduledExecutorService |
_execService
|
protected int |
_refreshDelayInSec
|
protected java.util.concurrent.ScheduledFuture |
_scheduledFuture
|
| Fields inherited from class Task.NetworkTask |
|---|
_exec, _swingWorker, _taskHandler, testMode_Enabled, testMode_isOnline |
| Fields inherited from class Task.AbstractTask |
|---|
_autoShutdownRay, _boundProperties, _boundPropertiesLock, _shutdownCalled, _state, _status, _taskManager |
| Constructor Summary | |
|---|---|
RecurringNetworkTask(TaskExecutorIF<ReturnValueType> exec)
|
|
RecurringNetworkTask(TaskManager container,
TaskExecutorIF<ReturnValueType> exec,
java.lang.String name,
java.lang.String descr,
AutoShutdownSignals... policy)
|
|
| Method Summary | |
|---|---|
protected void |
_cancelScheduledFuture()
This will cancel any Runnables that are being scheduled by the executor service. |
protected void |
_initScheduledFuture()
This method actually attaches a Runnable object + delay with the _execService. |
void |
doShutdown()
subclass should implement this method as is appropriate for them. this is called when the task is stopped, based on the AutoShutdownSignals policy |
AbstractTask.Type |
getType()
|
void |
restartWithNewDelay(int refreshDelayInSec)
After start(int) is called, this method can be used to change the refreshDelayInSec ... |
void |
setRefreshDelay(int refreshDelayInSec)
Set the time delay between running TaskExecutorIF continually. |
void |
start()
Start the recurring network task... it will use the default refresh delay... |
void |
start(int refreshDelayInSec)
Start the recurring network task... it will periodically run the TaskExecutorIF in the background. |
void |
stopRecurring()
Stop the recurring network task... this will stop the network task from running TaskExecutorIF in the background. |
| Methods inherited from class Task.NetworkTask |
|---|
_createSwingWorker, _openGate, execute, executeAndWait, getSwingWorker, setTaskHandler, setTestMode_isOnline |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected int _refreshDelayInSec
protected java.util.concurrent.ScheduledExecutorService _execService
protected java.util.concurrent.ScheduledFuture _scheduledFuture
| Constructor Detail |
|---|
public RecurringNetworkTask(TaskManager container,
TaskExecutorIF<ReturnValueType> exec,
java.lang.String name,
java.lang.String descr,
AutoShutdownSignals... policy)
throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentExceptionpublic RecurringNetworkTask(TaskExecutorIF<ReturnValueType> exec)
| Method Detail |
|---|
public AbstractTask.Type getType()
getType in class NetworkTask<ReturnValueType>public void doShutdown()
AutoShutdownSignals policy
doShutdown in class NetworkTask<ReturnValueType>
public void start(int refreshDelayInSec)
throws TaskException
TaskException
public void start()
throws TaskException
TaskException
public void restartWithNewDelay(int refreshDelayInSec)
throws TaskException
start(int) is called, this method can be used to change the refreshDelayInSec ...
TaskException
protected void _initScheduledFuture()
throws TaskException
NetworkTask.executeAndWait() method just
creates a new SwingWorker, and then waits for it to complete. The reason not to use NetworkTask.execute()
is simply to keep new tasks from getting created until the first one finishes. That's why there is a
gate to block the currently executing Runnable below until the underlying SwingWorker is complete!
So really, the total delay between these SwingWorkers being spawned is:
Time required by the SwingWorker to execute to completion (err, ok, interrupted) + delay
TaskExceptionprotected void _cancelScheduledFuture()
AbstractTask.cancel(),
NetworkTask.executeAndWait()public void stopRecurring()
NetworkTask.getSwingWorker() - Method to kill it:AbstractTask.cancel()
_scheduledFuture - Method to kill it:_cancelScheduledFuture()
public void setRefreshDelay(int refreshDelayInSec)
refreshDelayInSec - the time delay is in TimeUnit.SECONDS
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||