com.tivoli.twg.engine
Interface TWGTaskServer

All Superinterfaces:
java.lang.Runnable

public interface TWGTaskServer
extends java.lang.Runnable

This interface must be implemented by classes that perform the server portion of a task and are intended to be run in the server's JVM. When the server activates the TWGTask associated with this TWGTaskServer, a new thread is created using this object. Since this interface extends Runnable, a public void run() method must also be implemented.


Method Summary
 boolean serverActivate(TWGTask task)
          This method is called first so that the server task can perform any initialization prior to run() getting called.
 void serverDeactivate()
          This method is called when the server needs to deactivate this server task.
 int subtaskActivate(TWGTaskActivation act)
          This method is called when a subtask activation has been received from the console for this task.
 void subtaskDeactivate(TWGTaskActivation act)
          This method is called when a subtask deactivation has been received from the console for this task.
 
Methods inherited from interface java.lang.Runnable
run
 

Method Detail

serverActivate

public boolean serverActivate(TWGTask task)
This method is called first so that the server task can perform any initialization prior to run() getting called. If there are any other threads needed besides the thread that calls run() they should be created here. Since the thread calling serverActivate() is dedicated to the activation process, it is expected that control will not be returned from this call until server task activation has completed.

Returns:
true if server activation completed successfully. or false if it failed

serverDeactivate

public void serverDeactivate()
This method is called when the server needs to deactivate this server task. The server task should perform any necessary clean up including shutting down any additional threads it may have started and cause the thread running in the run() method to return.


subtaskActivate

public int subtaskActivate(TWGTaskActivation act)
This method is called when a subtask activation has been received from the console for this task. The thread calling this method is responsible for perfoming all subtaskActivate() calls, so control should not be kept here for long. If subtask activation requires waiting for an asynchronous state change or event to occur, then this method should return indicating that the activation is still pending and complete the subtask activation later by calling act.getTask().subtaskActivateComplete().

Parameters:
act - the TWGTaskActivation object for the subtask being activated.
Returns:
Use one of the following final values from TWGTask:
  • SUBTASK_ACT_COMPLETE - completed successfully
  • SUBTASK_ACT_FAILED - subtask activation failed
  • SUBTASK_ACT_PENDING - subtask activation will complete asynchronously

subtaskDeactivate

public void subtaskDeactivate(TWGTaskActivation act)
This method is called when a subtask deactivation has been received from the console for this task.