org.catnets.p2pagent.apiSamples.Echoes
Class EchoClient

java.lang.Object
  extended by org.catnets.p2pagent.api.P2pAgent
      extended by org.catnets.p2pagent.apiSamples.Echoes.EchoClient
All Implemented Interfaces:
org.catnets.p2pagent.hosting.AccessPoint, org.catnets.p2pagent.hosting.Task

public class EchoClient
extends org.catnets.p2pagent.api.P2pAgent

This class implements a simple requestor that executes a serie of request to a EchoServer and registers the time to completation of each request, computing an average at the end of this serie. The number of requests is defined by the parameter numRequests.

Version:
1.0
Author:
Pablo Chacin

Constructor Summary
EchoClient()
           
 
Method Summary
protected  void execute()
          Executes the main logic of the Client, initializing variables and starting the requests.
protected  void handleMessage(org.catnets.p2pagent.api.AgentMessage message)
          Handles the reply messages comming from the EchoServer.
 
Methods inherited from class org.catnets.p2pagent.api.P2pAgent
createAgent, done, done, error, forward, getAgentName, getAgentRefence, getBooleanArgument, getDoubleArgument, getIntArgument, getLongArgument, getObjectArgument, getStringArgument, getTransactionId, groupCast, groupCast, handleConnection, handleEvent, handleGroupCast, initialize, isArgumentsEmpty, joinGroup, log, logDebug, logError, logInfo, logWarning, reply, reportMetric, reportMetric, reportMetric, run, scheduleEvent, send, setBooleanResult, setDoubleResult, setIntgResult, setLongResult, setObjectResult, setStringResult, startTransaction, terminate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EchoClient

public EchoClient()
Method Detail

execute

protected void execute()
Executes the main logic of the Client, initializing variables and starting the requests. Each further request is initiate after a response is received.

Specified by:
execute in class org.catnets.p2pagent.api.P2pAgent

handleMessage

protected void handleMessage(org.catnets.p2pagent.api.AgentMessage message)
Handles the reply messages comming from the EchoServer. Calculates the round trip time and registers in the responseTimeVector used later to calculate the average round trip time. Calls the makeRequest method to issue another request.

Overrides:
handleMessage in class org.catnets.p2pagent.api.P2pAgent
See Also:
P2pAgent.handleMessage(AgentMessage)