Class ibm.aglets.patterns.Slave
All Packages Class Hierarchy This Package Previous Next Index
Class ibm.aglets.patterns.Slave
java.lang.Object
|
+----aglet.Aglet
|
+----aglet.a4compatibility.OldAglet
|
+----ibm.aglets.patterns.Slave
- public class Slave
- extends OldAglet
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 performing local computation in every destination. The
results of these local computations are accumulated and finally
submitted to the slave's Master (the creator of the slave). During
its tour the slave skips destinations which are not available (i.e.
it cannot be dispatched to).
When a slave:
1) completes its tour.
2) encounters an error during a local computation.
3) cannot be dispatched to yet unvisited destinations.
it immediately returns to its origin host and submits the
intermediate result.
-
ARGUMENT
- The protected variable that carries an argument for the local task
that the slave performs in every destination.
-
RESULT
- The protected variable that accumulates the results of the local tasks
that this slave performs in every destination.
-
Slave()
-
-
create(URL, String, AgletContext, Aglet, Itinerary, Object)
- Creates a slave.
-
doJob()
- This method should be overridden to specify the local task of
the slave.
-
getMaster()
- Gets the Aglet Idedntifier of the lave's master.
-
getOrigin()
- Gets the URL of the Origin of the aglet.
-
initializeJob()
- This method should be overridden to specify initialization part
for the job of the slave.
-
onCreation(Object)
- Initializes the slave.
-
onReturn()
- Called when the slave returns to its origin.
-
returnHome()
- Dispatch to the Origin
-
run()
- Universal entry point for the slave's execution thread.
-
setDefferedReturn(boolean)
- Define whether to defer the return of the slave to its
origin.
RESULT
protected Object RESULT
- The protected variable that accumulates the results of the local tasks
that this slave performs in every destination.
ARGUMENT
protected Object ARGUMENT
- The protected variable that carries an argument for the local task
that the slave performs in every destination.
Slave
public Slave()
initializeJob
protected abstract void initializeJob() throws Exception
- This method should be overridden to specify initialization part
for the job of the slave.
- Throws: AgletException
- if fails to complete.
doJob
protected abstract void doJob() throws Exception
- This method should be overridden to specify the local task of
the slave.
- Throws: AgletException
- if fails to complete.
getMaster
protected AgletIdentifier getMaster()
- Gets the Aglet Idedntifier of the lave's master.
getOrigin
protected URL getOrigin()
- Gets the URL of the Origin of the aglet.
returnHome
protected void returnHome() throws IOException, AgletException
- Dispatch to the Origin
onReturn
protected void onReturn()
- Called when the slave returns to its origin.
create
public static AgletProxy create(URL url,
String name,
AgletContext context,
Aglet master,
Itinerary itinerary,
Object argument) throws IOException, AgletException
- Creates 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 - the itinerary object.
- argument - the
argument
object.
- Returns:
- an aglet proxy for the slave.
- Throws: AgletException
- if initialization fails.
onCreation
public synchronized void onCreation(Object object)
- Initializes the slave. Only called the very first time this
slave is created. The initialization argument includes four
elements: the first is the master aglet, the second is the
Slave's itinerary, the third is the initial value of the
protected
result
variable and the fourth is the
value of protected argument
variable.
- Parameters:
- obj - the argument vector.
- Throws: AgletException
- if the initialization fails.
- Overrides:
- onCreation in class OldAglet
setDefferedReturn
public void setDefferedReturn(boolean b)
- Define whether to defer the return of the slave to its
origin.
run
public void run()
- Universal entry point for the slave's execution thread.
- Overrides:
- run in class Aglet
All Packages Class Hierarchy This Package Previous Next Index