org.opennms.netmgt.icmp.jna
Class JnaPinger

java.lang.Object
  extended by org.opennms.netmgt.icmp.jna.JnaPinger
All Implemented Interfaces:
Pinger

public class JnaPinger
extends Object
implements Pinger

Main

Author:
brozow

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

Constructor Detail

JnaPinger

public JnaPinger()
Method Detail

initialize

public void initialize()
                throws Exception
Initializes this singleton

Throws:
Exception

isV4Available

public boolean isV4Available()
Description copied from interface: Pinger
Whether or not IPv4 is initialized and available for this implementation.

Specified by:
isV4Available in interface Pinger

isV6Available

public boolean isV6Available()
Description copied from interface: Pinger
Whether or not IPv6 is initialized and available for this implementation.

Specified by:
isV6Available in interface Pinger
Returns:

ping

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

ping

Specified by:
ping in interface Pinger
Parameters:
host - a InetAddress object.
timeout - a long.
retries - a int.
sequenceId - a short.
cb - a org.opennms.netmgt.ping.PingResponseCallback object.
Throws:
Exception - if any.

ping

public Number 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.

Specified by:
ping in interface Pinger
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 Number ping(InetAddress host)
            throws Exception
Ping a remote host, using the default number of retries and timeouts.

Specified by:
ping in interface Pinger
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 List<Number> parallelPing(InetAddress host,
                                 int count,
                                 long timeout,
                                 long pingInterval)
                          throws Exception

parallelPing

Specified by:
parallelPing in interface Pinger
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.