Class PingRequest

java.lang.Object
com.tangosol.discovery.PingRequest

public class PingRequest extends Object
Make a ping request to a Coherence proxy server.

command options:

  • host the host of the proxy server to send the ping request
  • port the listen port of the proxy server
  • name the proxy service name
  • cluster the cluster name
  • timeout (optional) the timeout (in seconds) of the ping request, default 30s
  • list (optional) return a list of the address:port of the members in the proxy service, seperated by ','

Example: java com.tangosol.discovery.PingRequest -host proxyhost.mycompany.com -port 9000 -list
If the list option is specified, the program returns a hash value and a list of the IP socket addresses of the members of the proxy service in the Coherence cluster. For example: Addresses-hash: 1974466772 Address-list: [192.110.1.12:9910, 192:110:1:22:9990] Coherence proxy service ping succeeded Otherwise, the program returns the following message, indicating the proxy server is healthy: Coherence proxy service ping succeeded If the ping request fails, it returns error. For example: An exception occurred while executing the PingRequest: java.net.ConnectException: Connection refused Coherence proxy service ping failed If the ping request is sent to an older version of Coherence proxy server that does not support the returning of a list of IP socket addresses, the ping request is successful, but there is no list returned: Coherence proxy service ping succeeded

Since:
Coherence 12.2.1
Author:
lh 2014.04.17
  • Field Details

  • Constructor Details

    • PingRequest

      public PingRequest(String sHost, int nPort, String sName, String sCluster, int cTimeout, boolean fList)
      Construct the PingRequest.
      Parameters:
      sHost - host of the proxy server
      nPort - listen port of the proxy service
      sName - the proxy service name
      sCluster - the cluster name
      cTimeout - ping timeout, in seconds
      fList - whether to return a list of the address:port of the proxy servers in the proxy service.
  • Method Details

    • main

      public static void main(String[] asArg)
      Issue a proxy server ping request.
      Parameters:
      asArg - command line parameter array
    • missingArguments

      protected static void missingArguments()
      Report error and display the command-line instructions.
    • showInstructions

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

      public boolean ping() throws IOException
      Run the PingRequest.
      Returns:
      true if the ping is successful; false otherwise.
      Throws:
      IOException - if an I/O error occurs while reading from the socket stream
    • makeCheckSumHash

      public static long makeCheckSumHash(byte[] input)
      Given a byte array, return its checksum hash.
      Parameters:
      input - input byte array to make checksum from
      Returns:
      the checksum hash of the input data
    • readCollection

      public static Collection readCollection(DataInputStream inputStream) throws IOException
      Read a POF Collection of strings.
      Parameters:
      inputStream - socket input stream
      Returns:
      Collection read
      Throws:
      IOException - if an I/O error occurs while reading from the socket stream
    • nsLookup

      public boolean nsLookup() throws IOException
      Throws:
      IOException