org.opennms.netmgt.ping
Class Pinger

java.lang.Object
  extended by org.opennms.netmgt.ping.Pinger

public class Pinger
extends Object

Pinger class.

Version:
$Id: $
Author:
Ben Reed, Mathew Brozowski, Ben Reed, Mathew Brozowski

Constructor Summary
Pinger()
           
 
Method Summary
static void initialize()
          Initializes this singleton
static List<Number> parallelPing(InetAddress host, int count, long timeout, long pingInterval)
          parallelPing
static Long ping(InetAddress host)
          Ping a remote host, using the default number of retries and timeouts.
static Long ping(InetAddress host, long timeout, int retries)
          This method is used to ping a remote host to test for ICMP support.
static void ping(InetAddress host, long timeout, int retries, short sequenceId, PingResponseCallback cb)
          ping
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Pinger

public Pinger()
Method Detail

initialize

public static void initialize()
                       throws IOException
Initializes this singleton

Throws:
IOException - if any.

ping

public static void ping(InetAddress host,
                        long timeout,
                        int retries,
                        short sequenceId,
                        PingResponseCallback cb)
                 throws Exception

ping

Parameters:
host - a InetAddress object.
timeout - a long.
retries - a int.
sequenceId - a short.
cb - a PingResponseCallback object.
Throws:
Exception - if any.

ping

public static Long ping(InetAddress host,
                        long timeout,
                        int retries)
                 throws Exception
This method is used to ping a remote host to test for ICMP support. If the remote host responds within the specified period, defined by retries and timeouts, then the response time is returned.

Parameters:
host - The address to poll.
timeout - The time to wait between each retry.
retries - The number of times to retry
Returns:
The response time in microseconds if the host is reachable and has responded with an echo reply, otherwise a null value.
Throws:
InterruptedException - if any.
IOException - if any.
Exception - if any.

ping

public static Long ping(InetAddress host)
                 throws Exception
Ping a remote host, using the default number of retries and timeouts.

Parameters:
host - the host to ping
Returns:
the round-trip time of the packet
Throws:
IOException - if any.
InterruptedException - if any.
Exception - if any.

parallelPing

public static List<Number> parallelPing(InetAddress host,
                                        int count,
                                        long timeout,
                                        long pingInterval)
                                 throws Exception

parallelPing

Parameters:
host - a InetAddress object.
count - a int.
timeout - a long.
pingInterval - a long.
Returns:
a List object.
Throws:
Exception - if any.


Copyright © 2011. All Rights Reserved.