public interface TaskManager
ManagerFactory
.Modifier and Type | Method and Description |
---|---|
void |
addTaskListener(TaskListener theListener)
Adds a
TaskListener . |
Task |
getCurrentTask()
Returns an instance of the
Task the caller belongs to. |
java.util.List<Task> |
getTaskList(boolean includeSystem)
Returns a list of running tasks.
|
void |
removeTaskListener(TaskListener theListener)
Removes a
TaskListener . |
boolean |
setForegroundTask(Task task)
Assign foreground task.
|
boolean |
setPriority(Task task,
TaskPriority priority)
Changes priority for given
Task . |
Task |
startTask(Suite suite,
java.lang.String className)
|
boolean |
stopTask(Task task)
Stops given
Task . |
java.util.List<Task> getTaskList(boolean includeSystem)
includeSystem
- indicates whether to include system task
into list.Task getCurrentTask()
Task
the caller belongs to.Task
Task startTask(Suite suite, java.lang.String className) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException
Task
from given Suite
.
Throws an exception if suite
is a library and can therefore
not be started.
Calling this method schedules a new application execution. The new task
is created with TaskStatus.STARTING
on success or
TaskStatus.START_FAILED
on failure.
More than one call to this method can be performed for the same
arguments. In this case subsequent calls lead to attempts
to re-start the task (see
the concurrency chapter for details. It is not guaranteed that this
will be successful though. In case of unsuccessful attempt to re-start
the task, an appropriate exception is thrown or the corresponding state
TaskStatus.START_FAILED
is set to the returned task object.
suite
- the suite to start the task fromclassName
- the name of the class within the suite that is used to start
the application; this class MUST exist and MUST be derived from
MIDlet
Task
java.lang.IllegalArgumentException
- if the suite
argument is a
library, or if the specified class does not exist in the suite or
is not derived from MIDlet
java.lang.IllegalStateException
- if the suite
has been removedboolean stopTask(Task task) throws java.lang.IllegalStateException, java.lang.IllegalArgumentException
Task
.task
- the task to be stoppedtrue
if the task
was destroyedjava.lang.IllegalStateException
- in case the specified task has already been
stopped, has never been started or has already been finsihedjava.lang.IllegalArgumentException
- if the argument task is a system task,
means if a call to isSystemTask()
returns
true
boolean setForegroundTask(Task task) throws java.lang.IllegalArgumentException
A task is said to be in the foreground
If none of those packages is supported by the implementation, a call to this method has no effect.task
- the task to become foreground tasktrue
if task
was assigned as foreground,
otherwise false
java.lang.IllegalArgumentException
- if the argument task is a system task,
means if a call to isSystemTask()
returns
true
boolean setPriority(Task task, TaskPriority priority) throws java.lang.IllegalArgumentException
Task
.task
- the task to change priority forpriority
- new prioritytrue
if priority has been changed successfully,
false
otherwisejava.lang.IllegalArgumentException
- if the argument task is a system task,
means if a call to isSystemTask()
returns
true
void addTaskListener(TaskListener theListener)
TaskListener
. Several listeners can be added, each of them
will be notified about task status changes.theListener
- TaskListener
to be addedvoid removeTaskListener(TaskListener theListener)
TaskListener
.theListener
- TaskListener
to be removedCopyright (c) 2014, Oracle and/or its affiliates. All Rights Reserved. Use of this specification is subject to license terms.