Oracle® Coherence Java API Reference
v3.5

E14977-01

com.tangosol.net
Class DatagramTest

java.lang.Object
  extended by com.tangosol.util.Base
      extended by com.tangosol.net.DatagramTest

public class DatagramTest
extends Base

Test for datagram communication.

Author:
cp, mf 2005.10.24

Nested Class Summary
static class DatagramTest.DatagramListener
           
static class DatagramTest.DatagramPublisher
          The publisher test.
static class DatagramTest.ListenerConfig
          Holder for Listener configuration.
protected static class DatagramTest.PacketTracker
          Tracker of packet statistics for a single client.
static class DatagramTest.PublisherConfig
          Holder for Publisher configuration.
protected static class DatagramTest.StartFlag
          The start flag is used to allow a listener to control a inner process publisher.
static class DatagramTest.TestConfiguration
          Holder for Test configuration.
 
Field Summary
static java.lang.String COMMAND_ADDR_LOCAL
           
static java.lang.String COMMAND_LOG
           
static java.lang.String COMMAND_LOG_INTERVAL
           
static java.lang.String COMMAND_PACKET_SIZE
           
static java.lang.String COMMAND_PAYLOAD
           
static java.lang.String COMMAND_PROCESS_BYTES
           
static java.lang.String COMMAND_REPORT_INTERVAL
           
static java.lang.String COMMAND_RX_PACKET_BUFFER_SIZE
           
static java.lang.String COMMAND_RX_TIMEOUT_MS
           
static java.lang.String COMMAND_TICK_INTERVAL
           
static java.lang.String COMMAND_TX_DURATION_MS
           
static java.lang.String COMMAND_TX_ITERATIONS
           
static java.lang.String COMMAND_TX_PACKET_BUFFER_SIZE
           
static java.lang.String COMMAND_TX_RATE
           
static java.lang.String DEFAULT_ADDR_LOCAL
           
static java.lang.String DEFAULT_IP_LOCAL
           
static java.lang.String DEFAULT_LOG
           
static int DEFAULT_LOG_INTERVAL
           
static int DEFAULT_PACKET_SIZE
           
static int DEFAULT_PAYLOAD
           
static int DEFAULT_PORT
           
static int DEFAULT_PROCESS_BYTES
           
static int DEFAULT_REPORT_INTERVAL
           
static int DEFAULT_RX_PACKET_BUFFER_SIZE
           
static int DEFAULT_RX_TIMEOUT_MS
           
static int DEFAULT_TICK_INTERVAL
           
static long DEFAULT_TX_DURATION_MS
           
static int DEFAULT_TX_ITERATIONS
           
static int DEFAULT_TX_PACKET_BUFFER_SIZE
           
static int DEFAULT_TX_RATE
           
static int MB
           
static long s_ldtStart
          The application start time.
static java.util.Map s_mapAcksOut
          Map of InetAddr to AtomicCounter, each publisher address has an entry.
static java.lang.reflect.Method s_methodNano
          Java 1.5 System.nanoTime() if available
static java.lang.String SWITCH_HELP
           
static java.lang.String SWITCH_POLITE
           
static java.lang.String SWITCH_RAND
           
static java.lang.String[] VALID_COMMANDS
           
static java.lang.String[] VALID_SWITCHES
           
 
Constructor Summary
DatagramTest()
           
 
Method Summary
static boolean checkProcessPacketBytes(int cbPacket, int cProcessPacketBytes)
          Check that the value for processPacketBytes is acceptable.
static java.lang.String computeThroughputMBPerSec(long cBytes, long lDurationMs)
          Compute throughput as megabytes per second.
static java.lang.String computeThroughputPacketsPerSec(int cPackets, long lDurationMs)
          Compute throughput as packets per second.
protected static java.util.List extractSwitches(java.util.Collection colArg, java.lang.String[] asValidSwitch)
          Search the supplied argument set for known switches, and extract them.
static void main(java.lang.String[] asArg)
          Parse and validate the command-line parameters and run the test.
static long nanoTime()
           
protected static java.lang.Object processCommand(java.util.Map mapCommands, java.lang.String sName)
          Process a command from the command line arguments.
protected static java.lang.Object processCommand(java.util.Map mapCommands, java.lang.String sName, java.lang.Object oDefault)
          Process a command from the command line arguments.
protected static int processIntCommand(java.util.Map mapCommands, java.lang.String sName)
          Process a required command from the command line arguments, where the value is to be interpreted as an integer.
protected static int processIntCommand(java.util.Map mapCommands, java.lang.String sName, int iDefault)
          Process an optional command from the command line arguments, where the value is to be interpreted as an integer.
protected static long processLongCommand(java.util.Map mapCommands, java.lang.String sName, long lDefault)
          Process an optional command from the command line arguments, where the value is to be interpreted as an long.
protected static void showInstructions()
          Display the command-line instructions.
protected static java.net.InetSocketAddress translateAddress(java.lang.String sAddr)
          Convert an address:port string to an InetSocketAddress.
 

Field Detail

MB

public static final int MB
See Also:
Constant Field Values

COMMAND_ADDR_LOCAL

public static final java.lang.String COMMAND_ADDR_LOCAL
See Also:
Constant Field Values

DEFAULT_PORT

public static final int DEFAULT_PORT
See Also:
Constant Field Values

DEFAULT_IP_LOCAL

public static final java.lang.String DEFAULT_IP_LOCAL
See Also:
Constant Field Values

DEFAULT_ADDR_LOCAL

public static final java.lang.String DEFAULT_ADDR_LOCAL
See Also:
Constant Field Values

COMMAND_PACKET_SIZE

public static final java.lang.String COMMAND_PACKET_SIZE
See Also:
Constant Field Values

DEFAULT_PACKET_SIZE

public static final int DEFAULT_PACKET_SIZE
See Also:
Constant Field Values

COMMAND_PAYLOAD

public static final java.lang.String COMMAND_PAYLOAD
See Also:
Constant Field Values

DEFAULT_PAYLOAD

public static final int DEFAULT_PAYLOAD
See Also:
Constant Field Values

COMMAND_TX_RATE

public static final java.lang.String COMMAND_TX_RATE
See Also:
Constant Field Values

DEFAULT_TX_RATE

public static final int DEFAULT_TX_RATE
See Also:
Constant Field Values

COMMAND_PROCESS_BYTES

public static final java.lang.String COMMAND_PROCESS_BYTES
See Also:
Constant Field Values

DEFAULT_PROCESS_BYTES

public static final int DEFAULT_PROCESS_BYTES
See Also:
Constant Field Values

COMMAND_TX_PACKET_BUFFER_SIZE

public static final java.lang.String COMMAND_TX_PACKET_BUFFER_SIZE
See Also:
Constant Field Values

DEFAULT_TX_PACKET_BUFFER_SIZE

public static final int DEFAULT_TX_PACKET_BUFFER_SIZE
See Also:
Constant Field Values

COMMAND_RX_PACKET_BUFFER_SIZE

public static final java.lang.String COMMAND_RX_PACKET_BUFFER_SIZE
See Also:
Constant Field Values

DEFAULT_RX_PACKET_BUFFER_SIZE

public static final int DEFAULT_RX_PACKET_BUFFER_SIZE
See Also:
Constant Field Values

COMMAND_LOG

public static final java.lang.String COMMAND_LOG
See Also:
Constant Field Values

DEFAULT_LOG

public static final java.lang.String DEFAULT_LOG

COMMAND_REPORT_INTERVAL

public static final java.lang.String COMMAND_REPORT_INTERVAL
See Also:
Constant Field Values

DEFAULT_REPORT_INTERVAL

public static final int DEFAULT_REPORT_INTERVAL
See Also:
Constant Field Values

COMMAND_LOG_INTERVAL

public static final java.lang.String COMMAND_LOG_INTERVAL
See Also:
Constant Field Values

DEFAULT_LOG_INTERVAL

public static final int DEFAULT_LOG_INTERVAL
See Also:
Constant Field Values

COMMAND_TICK_INTERVAL

public static final java.lang.String COMMAND_TICK_INTERVAL
See Also:
Constant Field Values

DEFAULT_TICK_INTERVAL

public static final int DEFAULT_TICK_INTERVAL
See Also:
Constant Field Values

COMMAND_TX_ITERATIONS

public static final java.lang.String COMMAND_TX_ITERATIONS
See Also:
Constant Field Values

DEFAULT_TX_ITERATIONS

public static final int DEFAULT_TX_ITERATIONS
See Also:
Constant Field Values

COMMAND_TX_DURATION_MS

public static final java.lang.String COMMAND_TX_DURATION_MS
See Also:
Constant Field Values

DEFAULT_TX_DURATION_MS

public static final long DEFAULT_TX_DURATION_MS
See Also:
Constant Field Values

COMMAND_RX_TIMEOUT_MS

public static final java.lang.String COMMAND_RX_TIMEOUT_MS
See Also:
Constant Field Values

DEFAULT_RX_TIMEOUT_MS

public static final int DEFAULT_RX_TIMEOUT_MS
See Also:
Constant Field Values

VALID_COMMANDS

public static final java.lang.String[] VALID_COMMANDS

SWITCH_HELP

public static final java.lang.String SWITCH_HELP
See Also:
Constant Field Values

SWITCH_POLITE

public static final java.lang.String SWITCH_POLITE
See Also:
Constant Field Values

SWITCH_RAND

public static final java.lang.String SWITCH_RAND
See Also:
Constant Field Values

VALID_SWITCHES

public static final java.lang.String[] VALID_SWITCHES

s_mapAcksOut

public static java.util.Map s_mapAcksOut
Map of InetAddr to AtomicCounter, each publisher address has an entry.


s_ldtStart

public static final long s_ldtStart
The application start time.


s_methodNano

public static java.lang.reflect.Method s_methodNano
Java 1.5 System.nanoTime() if available

Constructor Detail

DatagramTest

public DatagramTest()
Method Detail

main

public static void main(java.lang.String[] asArg)
Parse and validate the command-line parameters and run the test.

Parameters:
asArg - an array of command line parameters
See Also:
showInstructions()

nanoTime

public static long nanoTime()

extractSwitches

protected static java.util.List extractSwitches(java.util.Collection colArg,
                                                java.lang.String[] asValidSwitch)
Search the supplied argument set for known switches, and extract them. Each switch which is found will be placed in the returned List and removed from the argument collection.

Parameters:
colArg - argument collection to parse, and remove switch from
asValidSwitch - switches to look for
Returns:
list of found switches

processCommand

protected static java.lang.Object processCommand(java.util.Map mapCommands,
                                                 java.lang.String sName)
                                          throws java.lang.UnsupportedOperationException
Process a command from the command line arguments. This method is used to process required commands, and will throw an exception if the command was not specified.

Parameters:
mapCommands - the map of command line arguments
sName - the name of the command to process
Returns:
the value
Throws:
java.lang.UnsupportedOperationException - if a no value is available

processCommand

protected static java.lang.Object processCommand(java.util.Map mapCommands,
                                                 java.lang.String sName,
                                                 java.lang.Object oDefault)
                                          throws java.lang.UnsupportedOperationException
Process a command from the command line arguments. This method is used to process optional commands, and the default will be returned if command was not explicitly specified.

Parameters:
mapCommands - the map of command line arguments
sName - the name of the command to process
oDefault - Specifies a default value
Returns:
the value, or oDefault if unspecified
Throws:
java.lang.UnsupportedOperationException

processIntCommand

protected static int processIntCommand(java.util.Map mapCommands,
                                       java.lang.String sName,
                                       int iDefault)
                                throws java.lang.UnsupportedOperationException
Process an optional command from the command line arguments, where the value is to be interpreted as an integer.

Parameters:
mapCommands - the map of command line arguments
sName - the name of the argument to process
iDefault - Specifies an default value
Returns:
the value, or iDefault if unspecified
Throws:
java.lang.UnsupportedOperationException

processIntCommand

protected static int processIntCommand(java.util.Map mapCommands,
                                       java.lang.String sName)
                                throws java.lang.UnsupportedOperationException
Process a required command from the command line arguments, where the value is to be interpreted as an integer.

Parameters:
mapCommands - the map of command line arguments
sName - the name of the argument to process
Returns:
the value
Throws:
java.lang.UnsupportedOperationException - if a no value is available

processLongCommand

protected static long processLongCommand(java.util.Map mapCommands,
                                         java.lang.String sName,
                                         long lDefault)
                                  throws java.lang.UnsupportedOperationException
Process an optional command from the command line arguments, where the value is to be interpreted as an long.

Parameters:
mapCommands - the map of command line arguments
sName - the name of the argument to process
lDefault - Specifies an default value
Returns:
the value, or iDefault if unspecified
Throws:
java.lang.UnsupportedOperationException

translateAddress

protected static java.net.InetSocketAddress translateAddress(java.lang.String sAddr)
                                                      throws java.net.UnknownHostException
Convert an address:port string to an InetSocketAddress.

Parameters:
sAddr - a legal address string
Returns:
a non-null InetSocketAddress object
Throws:
java.net.UnknownHostException

checkProcessPacketBytes

public static boolean checkProcessPacketBytes(int cbPacket,
                                              int cProcessPacketBytes)
Check that the value for processPacketBytes is acceptable. To be acceptable it must be a positive multiple of 4, and less then the packet size.

Parameters:
cbPacket - the packet size
cProcessPacketBytes - the number of bytes to process from each packet
Returns:
true if the value is acceptable, false otherwise

computeThroughputMBPerSec

public static java.lang.String computeThroughputMBPerSec(long cBytes,
                                                         long lDurationMs)
Compute throughput as megabytes per second.

Parameters:
cBytes - the number of bytes transfered
lDurationMs - the time in milliseconds the transfer took
Returns:
throughput a human redable string for the throughput expressed in megabytes per second

computeThroughputPacketsPerSec

public static java.lang.String computeThroughputPacketsPerSec(int cPackets,
                                                              long lDurationMs)
Compute throughput as packets per second.

Parameters:
cPackets - the number of packets transfered
lDurationMs - the time in milliseconds the transfer took
Returns:
throughput a human redable string for the throughput expressed in packets per second

showInstructions

protected static void showInstructions()
Display the command-line instructions.


Oracle® Coherence Java API Reference
v3.5

E14977-01

Copyright © 2000, 2009, Oracle. All rights reserved.