kaos.core.service.boot.usecase
Class CommSpeedTestSender

java.lang.Object
  extended by kaos.core.service.boot.KAoSAgent
      extended by kaos.core.service.boot.usecase.KAoSUsecase10New
          extended by kaos.core.service.boot.usecase.CommSpeedTestSender
All Implemented Interfaces:
KAoSAgentHelper

public class CommSpeedTestSender
extends KAoSUsecase10New

This class works as the sender part of a test programme developed to find out network transmission speed for a given transport. This class sends a number of consecutive messages with a certain size to its counterpart, i.e. the receiver, and when that is done, quits after printing the amount of time taken (in miliseconds) to send those messages. The number of messages can be set by a command line parameter -count, and the size of messages can be set by a command line parameter -size. Pl. note that the size set is in the multiple of 1024 bytes. The type of transport is set by a command line parameter -transport. Please also note that the receiver part of this test has to be started first and then the sender part.


Field Summary
 
Fields inherited from class kaos.core.service.boot.usecase.KAoSUsecase10New
CONVERSATION_FLAG, LOGGER, myDomain, STATEMENT
 
Fields inherited from class kaos.core.service.boot.KAoSAgent
_agentDescription, _agentDirectoryService, _agentNamingService, _agentNickname, _lctr, _logger, _messageTransportService, _name, _serviceRoot
 
Constructor Summary
CommSpeedTestSender()
           
 
Method Summary
protected  TransportMessage buildTransportMessage(AgentDescription agt, byte[] payload)
          Builds a TransportMessage for delivery to SpeedTestReceiver.
protected  void deregister()
          Deregisters this agent from the AgentDirectoryService.
protected  AgentDescription findSpeedTestReceiver()
          This method finds the locator of the receiver, the search is based on the hardcoded name of the receiver.
static void main(java.lang.String[] args)
           
protected  void sendTransportMessage(TransportMessage msg)
          Utilizes the MessageTransportService to send the TransportMessage to SpeedTestReceiver.
 
Methods inherited from class kaos.core.service.boot.usecase.KAoSUsecase10New
receiveMessage
 
Methods inherited from class kaos.core.service.boot.KAoSAgent
acquireAgentDirectoryService, acquireAgentName, acquireAgentNamingService, acquireMessageTransportService, assertFalse, assertTrue, bindToMessageTransportService, checkPermission, createTransportMessage, equals, establishAgentDescription, findAgentDescriptionForID, findAgentDescriptionForNickname, getAgentID, getKAoSAgentDescription, hashCode, initialize, logMessage, logMessage, printTransportMessage, sendMessage, verifyRegistration
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommSpeedTestSender

public CommSpeedTestSender()
Method Detail

findSpeedTestReceiver

protected AgentDescription findSpeedTestReceiver()
                                          throws java.lang.Exception
This method finds the locator of the receiver, the search is based on the hardcoded name of the receiver.

Throws:
java.lang.Exception

buildTransportMessage

protected TransportMessage buildTransportMessage(AgentDescription agt,
                                                 byte[] payload)
Builds a TransportMessage for delivery to SpeedTestReceiver. Building a TransportMessage consists of several operations: the building of a suitable Envelope and Payload. An empty TransportMessage can be obtained from the MessageTransportService, while the Payload instances can only be acquired from an AcrElementBuilder. Once you have a Payload instance, you need to put some kind of message (ACL Message) into it.

Parameters:
agt - the AgentDescription describing SpeedTestReceiver.
payload - the message content to be sent to SpeedTestReceiver.
Returns:
TransportMessage the message to send to SpeedTestReceiver.
See Also:
TransportMessage, AcrPayload, ServiceRoot#getAcrElementUtility, AcrElementUtility#getAcrElementBuilder, AcrElementUtility#getAcrElementHelper, AcrElementBuilder#createAcrAclMessage, AcrElementBuilder#createAcrPayload, "JAS Specification, Section(s) 2.2.3.3, 4.3.7, 4.3.8, 4.3.9"

sendTransportMessage

protected void sendTransportMessage(TransportMessage msg)
                             throws java.lang.Exception
Utilizes the MessageTransportService to send the TransportMessage to SpeedTestReceiver.

Parameters:
msg - the TransportMessage to send to SpeedTestReceiver.
Throws:
java.lang.Exception - if anything goes wrong during the send operation.
See Also:
"JAS Specification, Section(s) 2.2.3.4, 4.7.5"

deregister

protected void deregister()
                   throws java.lang.Exception
Deregisters this agent from the AgentDirectoryService.

Throws:
java.lang.Exception - if the deregistration fails.

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Throws:
java.lang.Exception