The application shows two agents, EchoesServer and EchoesClient, which commnicate in a send/reply model to implement a sort of "ping" command, as provided for TCPIP in most platforms. The EchoClient sends the "ping" messages using a groupcast to all the EchoServers in the neiborghood and registers the response time from each server.
EchoClient and EchoServer agents can be started in different JVMs as they communicate using P2P communication mechanisms.
This application can be considered a version of the Echoes Sample Application
Throught this example we can show how the following functionalities are implemented:
The application receives as command line parameters:
The application receives as command line parameters:
The client receives as parameters:
org.catnets.p2pagent.logging.LoggerAgentinitializing trace reporting
Also, in the client's work directory there should be a file named ResponseTime.txt
with a series of rows, each with the response time of each echo request sent by the client
to the server.
This file should look as follows:
1140714229886,EchoClient,ResponseTime,6565
org.catnets.p2pagent.logging.LoggerAgentinitializing trace reporting
Waiting for the agent to complete
< INFO 2006-03-08 16:08:00,660 JxtaConfig::
Timestamp: 1141830480511
Severity: INFO
AgentName: GroupCommunication
Component: org.catnets.p2pagent.groupCommunication.GroupCommunicationAgent
Event: Initializing
Message: Initialized
< INFO 2006-03-08 16:08:05,318 NullConfigurator::
< INFO 2006-03-08 16:08:05,319 NullConfigurator::resetFromResource:361> /home/pchacin/workspace/EchoesSample/EchoClient/PlatformConfig already exists
< INFO 2006-03-08 16:08:05,320 NullConfigurator::resetFromResource:361> /home/pchacin/workspace/EchoesSample/EchoClient/jxta.properties already exists
< INFO 2006-03-08 16:08:05,374 NullConfigurator::adjustLog4JPriority:440> Log4J [user default] requested, not adjusting logging priority
< INFO 2006-03-08 16:08:05,819 NullConfigurator::adjustLog4JPriority:440> Log4J [user default] requested, not adjusting logging priority
Timestamp: 1141830480660
Severity: INFO
AgentName: EchoClient
Component: EchoRequestor
Event: execute
Message: Initiating Agent
Timestamp: 1141830480663
Severity: INFO
AgentName: EchoClient
Component: EchoRequestor
Event: makeRequest
Message: Making requests
Timestamp: 1141830488204
Severity: INFO
AgentName: EchoClient
Component: EchoRequestor
Event: Response received
Message: Request 1 execution time: 7541
Timestamp: 1141830489416
Severity: INFO
AgentName: EchoClient
Component: EchoRequestor
Event: Response received
Message: Request 2 execution time: 8754
Agent has finished
Average echo time: 8147.5
Timestamp: 1141830490695
Severity: INFO
AgentName: EchoClient
Component: EchoClient
Event: Handling timeout
Message: Time out expired. Number of responses: 2
1140714231382,EchoClient,ResponseTime,7495
Server output
After executing the application a trace should be shown in the console. This
trace can also be seen in the file log.txt under the server's work directory.
The trace should look as follows:
Timestamp: 1141829477408
Severity: INFO
AgentName: EchoServer
Component: EchoServer
Event: execution
Message: Initiating agent
< INFO 2006-03-08 15:51:21,918 NullConfigurator::
< INFO 2006-03-08 15:51:21,919 NullConfigurator::resetFromResource:361> /home/pchacin/workspace/EchoesSample/EchoServer2/PlatformConfig already exists
< INFO 2006-03-08 15:51:21,923 NullConfigurator::resetFromResource:382> jxta.properties reset /home/pchacin/workspace/EchoesSample/EchoServer2/jxta.properties
< INFO 2006-03-08 15:51:21,982 NullConfigurator::adjustLog4JPriority:440> Log4J [user default] requested, not adjusting logging priority
< INFO 2006-03-08 15:51:22,442 NullConfigurator::adjustLog4JPriority:440> Log4J [user default] requested, not adjusting logging priority
Timestamp: 1141829499910
Severity: INFO
AgentName: OverlayAgent
Component: org.catnets.p2pagent.overlay.OverlayAgent
Event: processQuery
Message: JXTA handler processing a query: 0
Timestamp: 1141829499911
Severity: INFO
AgentName: EchoServer
Component: Server
Event: handle groupcast message
Message: Request Received
Timestamp: 1141829501410
Severity: INFO
AgentName: EchoServer
Component: Server
Event: handleEvent
Message: Event expired