com.ibm.agletx.patterns
Class Messenger

java.lang.Object
  |
  +--com.ibm.aglet.Aglet
        |
        +--com.ibm.agletx.patterns.Messenger
All Implemented Interfaces:
java.io.Serializable

public final class Messenger
extends Aglet

Create a Messenger by calling the static method create. The messenger will get dispatched automatically. The messenger carries a message between two remote aglets. Upon reaching the host of the receiver aglet and sending the message, the messenger complete its job and so, it is disposed. If a Messenger cannot be dispatched, it is disposed.

Version:
1.01 96/08/18
Author:
Danny B. Lange, Yariv Aridor
See Also:
Serialized Form

Fields inherited from class com.ibm.aglet.Aglet
ACTIVE, INACTIVE, MAJOR_VERSION, MINOR_VERSION
 
Constructor Summary
Messenger()
           
 
Method Summary
static AgletProxy create(AgletContext context, java.net.URL dest, AgletID id, Message message)
          Creates a messenger.
static AgletProxy create(AgletContext context, java.net.URL codebase, java.net.URL dest, AgletID id, Message message)
          Creates a messenger.
 void onCreation(java.lang.Object object)
          Initializes the messenger.
 void run()
          Universal entry point for the messenger's execution thread.
 
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, handleMessage, notifyAllMessages, notifyMessage, onDisposing, processCloneEvent, processMobilityEvent, processPersistencyEvent, removeCloneListener, removeMobilityListener, removePersistencyListener, setProtections, setStub, setText, snapshot, subscribeMessage, suspend, unsubscribeAllMessages, unsubscribeMessage, waitMessage, waitMessage
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Messenger

public Messenger()
Method Detail

create

public static AgletProxy create(AgletContext context,
                                java.net.URL dest,
                                AgletID id,
                                Message message)
                         throws java.io.IOException,
                                AgletException
Creates a messenger.
Parameters:
context - the aglet context in which the messenger should be created.
dest - the host of the receiver aglet.
id - the identifier of the receiver aglet.
message - the message object.
Returns:
an aglet proxy for the messenger.
Throws:
AgletException - if initialization fails.

create

public static AgletProxy create(AgletContext context,
                                java.net.URL codebase,
                                java.net.URL dest,
                                AgletID id,
                                Message message)
                         throws java.io.IOException,
                                AgletException
Creates a messenger.
Parameters:
context - the aglet context in which the messenger should be created.
codebase - the codebase of this class
dest - the host of the receiver aglet.
id - the identifier of the receiver aglet.
message - the message object.
Returns:
an aglet proxy for the messenger.
Throws:
AgletException - if initialization fails.

onCreation

public void onCreation(java.lang.Object object)
Initializes the messenger. The argument object containes the destination URL, the message and the identifier of the receiver aglet.
Overrides:
onCreation in class Aglet
Throws:
AgletException - if initialization fails.

run

public void run()
Universal entry point for the messenger's execution thread.
Overrides:
run in class Aglet
Following copied from class: com.ibm.aglet.Aglet
See Also:
Aglet.onCreation(java.lang.Object), CloneListener.onClone(com.ibm.aglet.event.CloneEvent), MobilityListener.onArrival(com.ibm.aglet.event.MobilityEvent), PersistencyListener.onActivation(com.ibm.aglet.event.PersistencyEvent)