|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.kuka.roboticsAPI.applicationModel.tasks.RoboticsAPITask
com.kuka.roboticsAPI.applicationModel.tasks.RoboticsAPIBackgroundTask
com.kuka.roboticsAPI.applicationModel.tasks.RoboticsAPICyclicBackgroundTask
public abstract class RoboticsAPICyclicBackgroundTask
Base class for cyclic background tasks.
Can be used to define a background task which should be triggered cyclically. Instead of run method of
the RoboticsAPIBackgroundTask provides runCyclic() method which will be
called cyclically with the specified period.
Cycle period and initial delay can be set by calling initializeCyclic(long, long, java.util.concurrent.TimeUnit, com.kuka.roboticsAPI.applicationModel.tasks.CycleBehavior) method
in the RoboticsAPITask.initialize() method of the inheriting class.
The cyclic background task can be terminated via Future.cancel(boolean) on the return value of
getCyclicFuture() or by stopping the task.
| Constructor Summary | |
|---|---|
protected |
RoboticsAPICyclicBackgroundTask()
Creates a new instance of the class with context from file "RoboticsAPI.config.xml". |
protected |
RoboticsAPICyclicBackgroundTask(RoboticsAPIContext context)
Creates a new instance of the class with specified context. |
| Method Summary | |
|---|---|
void |
dispose()
Disposes this task. |
ScheduledFuture<?> |
getCyclicFuture()
Gets the future object which controls the execution of the task. |
protected void |
initializeCyclic(long initialDelay,
long period,
TimeUnit timeUnit,
CycleBehavior behavior)
Initializes the parameters of the cyclic task. |
void |
run()
|
protected abstract void |
runCyclic()
Code in this method executes a periodic action that becomes enabled first after the initial delay, and subsequently with the period that can be set by calling initializeCyclic(long, long, java.util.concurrent.TimeUnit, com.kuka.roboticsAPI.applicationModel.tasks.CycleBehavior)
method. |
| Methods inherited from class com.kuka.roboticsAPI.applicationModel.tasks.RoboticsAPIBackgroundTask |
|---|
getApplicationUI |
| Methods inherited from class com.kuka.roboticsAPI.applicationModel.tasks.RoboticsAPITask |
|---|
getApplicationData, getContext, getController, getDevice, getDevice, getLogger, getObserverManager, getRecovery, getRobot, getRobot, getTaskFunction, getTaskManager, initialize |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.kuka.roboticsAPI.applicationModel.tasks.ILegacyRoboticsAPITask |
|---|
getContext, getLogger |
| Methods inherited from interface com.kuka.task.IRoboticsAPITask |
|---|
initialize |
| Constructor Detail |
|---|
protected RoboticsAPICyclicBackgroundTask()
protected RoboticsAPICyclicBackgroundTask(RoboticsAPIContext context)
context - context of the task.| Method Detail |
|---|
protected final void initializeCyclic(long initialDelay,
long period,
TimeUnit timeUnit,
CycleBehavior behavior)
It is recommended to call this method in the IRoboticsAPITask.initialize() method of the inheriting
class.
initialDelay - the time to delay first executionperiod - the period between successive executionstimeUnit - the time unit of the initialDelay and period parametersbehavior - Defines the behavior of a cyclic task if the execution of a cyclic method takes longer than the given
period time.protected abstract void runCyclic()
initializeCyclic(long, long, java.util.concurrent.TimeUnit, com.kuka.roboticsAPI.applicationModel.tasks.CycleBehavior)
method. CycleBehavior.BestEffort is set, subsequent executions may start late, but will not concurrently execute.
If CycleBehavior.Strict behavior is set and this method takes longer than the specified period, cyclic
task will be terminated with CycleExceededException.
public final void run()
public void dispose()
Use this to dispose the cyclic task and all of your resources.
Basic implementation calls getContext().dispose() and stops and disposes the cyclic worker.
It is strongly recommended to call super.dispose() when overriding this method.
dispose in interface com.kuka.task.IRoboticsAPITaskdispose in class RoboticsAPITaskpublic ScheduledFuture<?> getCyclicFuture()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||