All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.ibm.agletx.patterns.Slave

java.lang.Object
   |
   +----com.ibm.aglet.Aglet
           |
           +----com.ibm.agletx.patterns.Slave

public abstract class Slave
extends Aglet
Create a slave by calling the static method create. The slave will get dispatched automatically.
Given an itinerary, the slave is travelled from one destination to another while repeating a local computation in every destination. Then, a final result is delivered to the slave's Master (the creator of the slave). During its tour the slave aglet skips destinations which are not available.
When a slave:
1) completes its tour.
2) encounters an error during a local computation.
3) cannot be further dispatched to yet unvisited destinations.
it immediately returns to its origin host and submits the intermediate result.


Constructor Index

 o Slave()

Method Index

 o create(URL, String, AgletContext, Aglet, Vector, Object)
Create a slave.
 o getMaster()
 o getOrigin()
Return the address of origin of the Slave (i.e.
 o handleMessage(Message)
Handles the message form outside.
 o onCreation(Object)
Initialize the slave.

Constructors

 o Slave
 public Slave()

Methods

 o handleMessage
 public boolean handleMessage(Message msg)
Handles the message form outside.

Overrides:
handleMessage in class Aglet
 o create
 public static AgletProxy create(URL url,
                                 String name,
                                 AgletContext context,
                                 Aglet master,
                                 Vector itinerary,
                                 Object argument) throws IOException, AgletException
Create a slave.

Parameters:
url - the url of the aglet class.
name - the name of the aglet class.
context - the aglet context in which the slave should be created.
master - the master aglet.
itinerary - A vector of addresses of destinations
argument - the
 argument 
object.
Returns:
an aglet proxy for the slave.
Throws: AgletException
if initialization fails.
 o onCreation
 public synchronized void onCreation(Object object)
Initialize the slave. It is called only the first time the slave is created. The initialization argument includes four elements: (1) the master aglet and (2) the Slave's itinerary, and (3) an argument for the local task.

Parameters:
obj - the initialization argument
Throws: AgletException
if the initialization fails.
Overrides:
onCreation in class Aglet
 o getOrigin
 public String getOrigin()
Return the address of origin of the Slave (i.e. the host from which it started its tour).

Returns:
the address of the origin.
 o getMaster
 public AgletID getMaster()

All Packages  Class Hierarchy  This Package  Previous  Next  Index