OpenNMS API 1.2.3

org.opennms.netmgt.discovery
Class PingManager

java.lang.Object
  extended byorg.opennms.netmgt.discovery.PingManager
All Implemented Interfaces:
Fiber, PausableFiber, java.lang.Runnable

final class PingManager
extends java.lang.Object
implements java.lang.Runnable, PausableFiber


Nested Class Summary
(package private) static class PingManager.Pinger
           
 
Field Summary
private  FifoQueue m_discoveredQ
           
private  short m_filterId
           
private  ReplyReceiver m_icmpReceiver
           
private  PingManager.Pinger[] m_pingers
           
private  FifoQueue m_replyQ
           
private  QuantumSemaphore m_semaphore
           
private  IcmpSocket m_socket
           
private  int m_status
           
private  java.lang.Thread m_worker
           
private static long TID_CONST_KEY
           
 
Fields inherited from interface org.opennms.core.fiber.PausableFiber
PAUSE_PENDING, PAUSED, RESUME_PENDING
 
Fields inherited from interface org.opennms.core.fiber.Fiber
RUNNING, START_PENDING, STARTING, STATUS_NAMES, STOP_PENDING, STOPPED
 
Constructor Summary
(package private) PingManager(FifoQueue addressQ, FifoQueue discoveredQ, short filterId, int threads, int pktsPerSecond)
          Constructs a new instance of a ping manager.
 
Method Summary
 java.lang.String getName()
          Returns the name of this fiber.
 int getStatus()
          Returns the current manager status.
 void pause()
          Pauses the currently running manager.
 void resume()
          Resumes a currently paused manager.
 void run()
          This is the main method that receives the ICMP replies from the ICMP recever and processes them.
 void start()
          Starts the ping manager.
 void stop()
          Stops the currently running ping manager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TID_CONST_KEY

private static final long TID_CONST_KEY
See Also:
Constant Field Values

m_pingers

private PingManager.Pinger[] m_pingers

m_semaphore

private QuantumSemaphore m_semaphore

m_socket

private IcmpSocket m_socket

m_replyQ

private FifoQueue m_replyQ

m_discoveredQ

private FifoQueue m_discoveredQ

m_icmpReceiver

private ReplyReceiver m_icmpReceiver

m_status

private int m_status

m_filterId

private short m_filterId

m_worker

private java.lang.Thread m_worker
Constructor Detail

PingManager

PingManager(FifoQueue addressQ,
            FifoQueue discoveredQ,
            short filterId,
            int threads,
            int pktsPerSecond)
      throws java.io.IOException
Constructs a new instance of a ping manager. Once the manager is constructed it must be started with a call to the method start.

Parameters:
addressQ - The input address queue.
discoveredQ - The output queue of responding addresses.
threads - The number of pinging fibers to create.
pktsPerSecond - The maximum packets per second that can be generated.
Throws:
java.io.IOException - Thrown if the ICMP socket cannot be constructed.
Method Detail

start

public void start()
Starts the ping manager.

Specified by:
start in interface Fiber
Throws:
java.lang.IllegalStateException - Thrown if the fiber has previously been started.

stop

public void stop()
Stops the currently running ping manager. If the manager has never been run then an exception is generated.

Specified by:
stop in interface Fiber
Throws:
java.lang.IllegalStateException - Thrown if the fiber has never been started.

pause

public void pause()
Pauses the currently running manager. If the manager is already paused or is stopping, then the call is silently ignored. If the fiber is not currently running, either due to it being stopped or having never been started, then an exception is generated.

Specified by:
pause in interface PausableFiber
Throws:
java.lang.IllegalStateException - Thrown if the fiber is not running.

resume

public void resume()
Resumes a currently paused manager. If the manager is not running, either by never being started or it has stopped then an exception is generated. If the manager is not currently paused then the manager silently discards the request.

Specified by:
resume in interface PausableFiber
Throws:
java.lang.IllegalStateException - Thrown if the manager is not currently active.

getStatus

public int getStatus()
Returns the current manager status.

Specified by:
getStatus in interface Fiber
Returns:
The manager's status

getName

public java.lang.String getName()
Returns the name of this fiber.

Specified by:
getName in interface Fiber
Returns:
The name of the fiber.

run

public void run()
This is the main method that receives the ICMP replies from the ICMP recever and processes them. If the replies match the expected format then each reply is added to the output queue for discovered elements.

Specified by:
run in interface java.lang.Runnable

OpenNMS API 1.2.3

Generated by eevans on May 29 2005 2015.