com.ibm.agletx.patterns
Class 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.
- See Also:
- Serialized Form
|
Constructor Summary |
Slave()
|
| Methods inherited from class com.ibm.aglet.Aglet |
addCloneListener,
addMobilityListener,
addPersistencyListener,
clone,
deactivate,
dispatch,
dispatch,
dispatchEvent,
dispose,
exitMonitor,
getAgletContext,
getAgletID,
getAgletInfo,
getAudioData,
getCodeBase,
getImage,
getImage,
getMessageManager,
getProtections,
getProxy,
getText,
notifyAllMessages,
notifyMessage,
onDisposing,
removeCloneListener,
removeMobilityListener,
removePersistencyListener,
run,
setProtections,
setStub,
setText,
snapshot,
subscribeMessage,
suspend,
unsubscribeAllMessages,
unsubscribeMessage,
waitMessage,
waitMessage |
| Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Slave
public Slave()
handleMessage
public boolean handleMessage(Message msg)
- Description copied from class: Aglet
- Handles the message form outside.
- Overrides:
- handleMessage in class Aglet
- Tags copied from class: Aglet
- Parameters:
msg - the message sent to the aglet- Returns:
- true if the message was handled. Returns false if the message
was not handled. If false is returned, the MessageNotHandled exception
is thrown in the FutureReply.getReply and AgletProxy.sendMessage
methods.
- See Also:
FutureReply.getReply(),
Message.sendReply(java.lang.Object),
AgletProxy.sendMessage(com.ibm.aglet.Message)
create
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
- 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 destinationsargument - the argument
object.- Returns:
- an aglet proxy for the slave.
- Throws:
- AgletException - if initialization fails.
onCreation
public void onCreation(java.lang.Object object)
- Initialize the slave. It is called only the first time the
slave is created. The initialization argument includes three
elements: (1) the master aglet and (2) the Slave's itinerary,
and (3) an argument for the local task.
- Overrides:
- onCreation in class Aglet
- Parameters:
obj - the initialization argument- Throws:
- AgletException - if the initialization fails.
getOrigin
public java.lang.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.
getMaster
public AgletID getMaster()