|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.ibm.aglet.Aglet
com.ibm.agletx.patterns.Slave
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.
| Field Summary | |
protected java.lang.Object |
ARGUMENT
The protected variable that carries an argument for the local task performed in every destination. |
private SlaveAgletItinerary |
itin
|
private AgletID |
master
|
protected java.lang.Object |
RESULT
The protected variable that accumulates the results of the local task performed in every destination. |
| Fields inherited from class com.ibm.aglet.Aglet |
ACTIVE, INACTIVE, MAJOR_VERSION, MINOR_VERSION |
| Constructor Summary | |
Slave()
|
|
| Method Summary | |
static AgletProxy |
create(java.net.URL url,
java.lang.String name,
AgletContext context,
Aglet master,
java.util.Vector itinerary,
java.lang.Object argument)
Create a slave. |
protected abstract void |
doJob()
This method should be overridden to specify the local task of the slave. |
AgletID |
getMaster()
|
private AgletProxy |
getMasterProxy(AgletID master,
Aglet aglet)
|
java.lang.String |
getOrigin()
Return the address of origin of the Slave (i.e. |
boolean |
handleMessage(Message msg)
Handles the message form outside. |
protected abstract void |
initializeJob()
This method should be overridden to specify initialization part for the job of the slave. |
void |
onCreation(java.lang.Object object)
Initialize the slave. |
private void |
onError(SlaveError error)
|
private void |
onReturn()
|
private void |
print(java.lang.String text)
|
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private AgletID master
private SlaveAgletItinerary itin
protected java.lang.Object RESULT
protected java.lang.Object ARGUMENT
| Constructor Detail |
public Slave()
| Method Detail |
public static AgletProxy create(java.net.URL url,
java.lang.String name,
AgletContext context,
Aglet master,
java.util.Vector itinerary,
java.lang.Object argument)
throws java.io.IOException,
AgletException
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 destinationsargument - the argumentobject.
AgletException - if initialization fails.
java.io.IOException
protected abstract void doJob()
throws java.lang.Exception
AgletException - if fails to complete.
java.lang.Exceptionpublic AgletID getMaster()
private AgletProxy getMasterProxy(AgletID master,
Aglet aglet)
throws AgletException
AgletExceptionpublic java.lang.String getOrigin()
public boolean handleMessage(Message msg)
Aglet
handleMessage in class AgletFutureReply.getReply(),
Message.sendReply(),
AgletProxy.sendMessage(com.ibm.aglet.Message)
protected abstract void initializeJob()
throws java.lang.Exception
AgletException - if fails to complete.
java.lang.Exceptionpublic void onCreation(java.lang.Object object)
onCreation in class Agletobject - the argument with which the aglet is initialized.
AgletException - if the initialization fails.AgletContext.createAglet(java.net.URL, java.lang.String, java.lang.Object)private void onError(SlaveError error)
private void onReturn()
private void print(java.lang.String text)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||