|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectTask.Support.EnhancedListeners.EnhancedListenerManager<TaskListChangeListener>
Task.Manager.TaskManager
public class TaskManager
TaskManager is a class that makes it easier for tasks to be created and a history of running and dead tasks maintained in an application.
All the tasks stopped and purged, as is determined by theirAutoShutdownSignals
policy (that's defined in the task itself). You have to call autoShutdownOn(AutoShutdownSignals)
and pass it the appropriate
AutoShutdownSignals enumeration to perform this auto shutdown... you can extend the enumeration
to add different signals that are more appropriate to your application. If you want to kill all running tasks
then issue a shutdownAll().
Tasks are not automatically started. This has to be done explicitly by you/your app.
Regardless of whether a task has been auto stopped (by a call to autoShutdownOn(AutoShutdownSignals) or
manually stopped, the list of tasks is pruned by this manager, it's checked for tasks that have not been stopped,
and these are NOT removed!
When the task list changes, TaskListChangeEvents are fired to any registered
TaskListChangeListeners. If you register a soft-listener, then it will be pruned/purged when a
shutdownAll() is invoked.
| Field Summary |
|---|
| Fields inherited from class Task.Support.EnhancedListeners.EnhancedListenerManager |
|---|
_listeners |
| Constructor Summary | |
|---|---|
TaskManager()
default constructor |
|
| Method Summary | |
|---|---|
void |
autoShutdownOn(AutoShutdownSignals stopOnThis)
stops any registered tasks that have an AutoShutdownSignals policy that matches what's in shutdown. |
java.util.List<AbstractTask> |
getCopyOfList()
returns a copy of the task list |
boolean |
isOnline()
|
void |
offline()
|
void |
online()
|
void |
registerTask(AbstractTask task)
Registers the given task with the container. |
void |
shutdownAll()
stops ALL tasks that are registered with this manager. this includes AutoShutdownSignals.Daemon tasks
as well. |
void |
unregisterTask(AbstractTask task)
Unregisters the task, whether it's a daemon task or not. |
void |
writeExceptionToLog(java.util.logging.Level warning,
java.lang.String s,
TaskException e)
|
| Methods inherited from class Task.Support.EnhancedListeners.EnhancedListenerManager |
|---|
addListener, fireUpdatesToListeners, fireUpdateToListeners, pruneSoftListeners, removeListener |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public TaskManager()
| Method Detail |
|---|
public void offline()
public void online()
public boolean isOnline()
public void shutdownAll()
AutoShutdownSignals.Daemon tasks
as well.
public void autoShutdownOn(AutoShutdownSignals stopOnThis)
AutoShutdownSignals policy that matches what's in shutdown.
stopOnThis - match all the registered tasks's autostop policy with this
public void registerTask(AbstractTask task)
throws java.lang.IllegalArgumentException
task - task to register with the container
java.lang.IllegalArgumentException
public void unregisterTask(AbstractTask task)
throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentExceptionpublic java.util.List<AbstractTask> getCopyOfList()
public void writeExceptionToLog(java.util.logging.Level warning,
java.lang.String s,
TaskException e)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||