one.toys
Class Mover

java.lang.Object
  |
  +--one.world.core.Component
        |
        +--one.toys.Mover
All Implemented Interfaces:
Serializable

public final class Mover
extends Component

Implementation of the mover application. The mover application repeatedly moves itself across two or more nodes in a round-robin fashion. The node on which this application is originally activated is the application's home node. When encountering an error or when being restored from a saved check-point, the mover application always returns to the home node and starts the next iteration. Clones of the mover application kill themselves immediately.

The best way to stop the mover application is to set up a "roadblock": Create an environment with the same name as the mover application's environment in the root environment of one of the nodes the mover application is not currently running on. This may take a few attempts, especially when running the mover application on only two nodes. When the mover application tries to move to the node with the roadblock, it will fail, because an environment with the same name already exists. After several attempts (with exponentially increasing nap times), the mover application will give up trying and exit.

Imported and Exported Event Handlers

Exported event handlers:

main
Handles environment events, linked to an environment's main imported event handler.

Imported event handlers:

request
Handles environment events, linked to an environment's request exported event handler.

Version:
$Revision: 1.3 $
See Also:
Serialized Form

Inner classes inherited from class one.world.core.Component
Component.HandlerReference, Component.Importer
 
Constructor Summary
Mover(Environment env, String[] hosts)
          Create a new instance of Mover.
 
Method Summary
 ComponentDescriptor getDescriptor()
          Get the component descriptor.
static void init(Environment env, Object closure)
          Initialize the mover application.
 
Methods inherited from class one.world.core.Component
declareExported, declareImported, equals, eventHandlers, getDescriptor, getEnvironment, getLinkedHandlers, getLinkedNumber, getTimer, hasEventHandler, hashCode, isFullyLinked, isLinked, isSealed, link, link, run, seal, unbox, undeclare, unlink, wrap
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Mover

public Mover(Environment env,
             String[] hosts)
      throws UnknownHostException
Create a new instance of Mover.
Parameters:
env - The environment for the new instance.
hosts - The hosts (in standard URL notation <address>[:<port>]) to be visited by this mover.
Throws:
IllegalStateException - Signals that this node does not have an IP address.
IllegalArgumentException - Signals that the list of nodes is empty, that an invalid port number has been specified, or that one of the specified hosts is the same as the previous host.
UnknownHostException - Signals that one of the host addresses cannot be resolved.
Method Detail

getDescriptor

public ComponentDescriptor getDescriptor()
Get the component descriptor.
Overrides:
getDescriptor in class Component
Following copied from class: one.world.core.Component
Returns:
The component descriptor for this component.

init

public static void init(Environment env,
                        Object closure)
                 throws UnknownHostException
Initialize the mover application. The closure must be a string array that specifies the hosts to be visited by the newly created mover application (omitting the current, that is, home host). Each host is specified using the standard URL notation of <address>[:<port>]. The optional port specifies the default REP port for that instance of one.world.
Parameters:
env - The environment for the new mover application.
closure - The closure for the new mover application, which specifies the hosts to be visited.
Throws:
IllegalStateException - Signals that this node does not have an IP address.
IllegalArgumentException - Signals that the closure is not a string array or an empty array or that one of the specified hosts is the same as the previous host.
UnknownHostException - Signals that one of the hosts cannot be resolved.


(C) Copyright 2001 UW CSE