com.kuka.task
Interface ITaskInstance


public interface ITaskInstance

Task instance representation.

This is a wrapper for running instance of a task.
The class implementing this interface is not the main class of the task. It is not possible to get the reference to it using this API. Please use task function mechanism to implement interaction between tasks getTaskFunction(Class).

See Also:
ITask

Method Summary
 void addStateListener(ITaskInstanceStateListener listener)
          Adds a listener for the user task's TaskState changes.
 Throwable getError()
          Gets the exception which caused termination of the task instance.
 List<Object> getParameters()
          Gets all parameters with which the instance was started.
<F> F
getTaskFunction(Class<F> functionClass)
          Returns an instance of the type represented by the given task function class that allows access to the task function provided this task instance.
 void removeStateListener(ITaskInstanceStateListener listener)
          Unregisters a TaskState change event listener.
 

Method Detail

getParameters

List<Object> getParameters()
Gets all parameters with which the instance was started.

Returns:
all parameters with which the instance was started.

getTaskFunction

<F> F getTaskFunction(Class<F> functionClass)
Returns an instance of the type represented by the given task function class that allows access to the task function provided this task instance. The instance returned will be a proxy for the actual task function instance.

This proxy allows the methods of the task function to be called only when the providing task instance is running. If you access the task function methods while the providing instance is not running yet or has stopped running, an InstanceNotRunningException will be thrown from the method. If you need to wait for the availability of the task function, you can create a TaskFunctionMonitor.

Type Parameters:
F - The type of the task function.
Parameters:
functionClass - The task function class.
Returns:
a proxy to the task function
Throws:
FunctionNotAvailableException - if this instance does not provide task functions of the given type

addStateListener

void addStateListener(ITaskInstanceStateListener listener)
Adds a listener for the user task's TaskState changes. The listeners will be called synchronously from a separate, single thread before resuming with the execution.

Parameters:
listener - the event listener to register

removeStateListener

void removeStateListener(ITaskInstanceStateListener listener)
Unregisters a TaskState change event listener.

Parameters:
listener - the event listener to unregister

getError

Throwable getError()
Gets the exception which caused termination of the task instance.

Returns:
the exception which caused termination of the task instance or null if instance was finished normally.


Copyright © 2019. All rights reserved.