All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----com.ibm.aglet.event.MobilityAdapter | +----com.ibm.agletx.util.AlternateItinerary
AlternateItinerary itinerary= null; public boolean handleMessage(Message msg) { if (msg.sameKind("test")) { System.out.println("arrived!!!"); return true; } return false; } public void onCreation(Object ini) { itinerary = new AlternateItinerary(this); itinerary.addAlternate("atp://tsdsai.trl.ibm.com:434"); itinerary.addAlternate("atp://yariv.trl.ibm.com:434"); try { itinerary.go("test"); } catch (SecurityException ex) { // a RuntimeException // failed to the aglet specific problems. } catch (IOException ex) { // failed due to communication problems. } }In the above code, the go() tries to dispatch the owner aglet to one of the alternative destinations specified by the addAlternate(). If succeeds, it sends Message("test") to the owner aglet upon its arrival to that destination. If multiple destinations are available to host the owner aglet, the selection is implementation-dependant. If fails, it throws an IOException exception (in case of communication problems) or SecurityException (otherwise).
public AlternateItinerary(Aglet aglet)
public void addAlternate(String address)
public void removeAlternate(String address)
public void go(Message msg) throws IOException
public void go(String msg) throws IOException
public void go() throws IOException
public void onArrival(MobilityEvent ev)
All Packages Class Hierarchy This Package Previous Next Index