springs.tests
Class MovingSpringsAgentDynamicRefs

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--java.rmi.server.UnicastRemoteObject
                    |
                    +--springs.agent.SpringsAgent_RMIImpl
                          |
                          +--springs.tests.MovingSpringsAgentDynamicRefs
All Implemented Interfaces:
IMovingSpringsAgentDynamicRefs, ISpringsAgent_RMIImpl, java.rmi.Remote, java.io.Serializable, SpringsAgent
Direct Known Subclasses:
MovingSpringsAgentDynamicRefsHolder

public class MovingSpringsAgentDynamicRefs
extends SpringsAgent_RMIImpl
implements IMovingSpringsAgentDynamicRefs

A moving Springs agent to test dynamic references.

Author:
Sergio Ilarri Artigas
See Also:
Serialized Form

Field Summary
protected  int _numTravelsPerformed
           
protected  java.util.Random _randomGenerator
           
static long MILLIS_BETWEEN_TRAVELS
           
static int NUM_TRAVELS_TO_PERFORM
           
static int[] TARGET_PORTS
           
static java.lang.String[] TARGET_URLS
           
 
Fields inherited from class springs.agent.SpringsAgent_RMIImpl
_numberOfJumps
 
Fields inherited from class java.rmi.server.UnicastRemoteObject
 
Fields inherited from class java.rmi.server.RemoteServer
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Fields inherited from interface springs.agent.SpringsAgent
METHOD_MESSAGE_RECEPTION
 
Fields inherited from interface springs.agent.ISpringsAgent_RMIImpl
ADD_OBSERVER_METHOD, REMOVE_OBSERVER_METHOD
 
Constructor Summary
MovingSpringsAgentDynamicRefs()
           
 
Method Summary
 void main()
          Main method of the agent.
 void sayReceivedTime(java.lang.Long millis)
          Prints a message in the output saying the milliseconds given as an argument.
protected  void travelToRandomContext()
          Selects randomly a target context and travels there.
 
Methods inherited from class springs.agent.SpringsAgent_RMIImpl
addObserver, addTaskToSchedule, addTaskToSchedule, addTaskToSchedule, addTaskToSchedule, addTaskToSchedule, afterCreation, afterRemoval, atHome, beforeCreation, beforeRemoval, callAgentMethod, callAgentMethod, callAgentMethodAsynchronously, callAgentMethodAsynchronously, callback, checkpoint, getAddress, getAgentInitializationTime, getAgentMoving, getArgsCallbackMethod, getCallbackMethod, getCodebase, getContextInterfaceForAgents, getContextName, getHomeAddress, getHostname, getLocationServers, getMillisStay, getMillisWhenCreated, getName, getNameWithContext, getNumObservers, getObservers, getObserversAddresses, getPort, getSchedule, getSequenceNumberForAddressUpdateMessages, getURL, goHome, goHome, goHome, handleMessage, hasCallbackMethod, increaseSequenceNumberForAddressUpdateMessages, initialization, initializationAfterMovement, isSuspended, justCreatedForTheFirstTime, moreTasksInSchedule, moveTo, moveTo, moveTo, moveTo, moveTo, moveTo, moveToURL, moveToURL, moveToURL, moveToURL, postArrival, postDeparture, preArrival, preDeparture, receiveMethodCall, recordEndStay, recordStartStay, remove, removeObserver, sendAsynchronousMessage, sendMessage, sendMessage, setAgentInitializationTime, setAgentMoving, setCacheReferences, setCallbackMethod, setCodebase, setContextInterfaceForAgents, setHomeAddress, setLocationServers, setName, start, suspend, takeNextTask
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

TARGET_URLS

public static java.lang.String[] TARGET_URLS

TARGET_PORTS

public static int[] TARGET_PORTS

NUM_TRAVELS_TO_PERFORM

public static int NUM_TRAVELS_TO_PERFORM

MILLIS_BETWEEN_TRAVELS

public static long MILLIS_BETWEEN_TRAVELS

_numTravelsPerformed

protected int _numTravelsPerformed

_randomGenerator

protected java.util.Random _randomGenerator
Constructor Detail

MovingSpringsAgentDynamicRefs

public MovingSpringsAgentDynamicRefs()
                              throws java.rmi.RemoteException
Method Detail

main

public void main()
Main method of the agent.

Specified by:
main in interface SpringsAgent
Overrides:
main in class SpringsAgent_RMIImpl

travelToRandomContext

protected void travelToRandomContext()
                              throws AgentMovementException
Selects randomly a target context and travels there.

Throws:
AgentMovementException - if error.
See Also:
AgentMovementException

sayReceivedTime

public void sayReceivedTime(java.lang.Long millis)
                     throws java.rmi.RemoteException
Description copied from interface: IMovingSpringsAgentDynamicRefs
Prints a message in the output saying the milliseconds given as an argument.

Specified by:
sayReceivedTime in interface IMovingSpringsAgentDynamicRefs
Parameters:
millis - the milliseconds.
java.rmi.RemoteException
See Also:
Long, RemoteException