|
OpenNMS API 1.1.4 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opennms.netmgt.discovery.PingManager.Pinger
Field Summary | |
(package private) static int |
IDLE
This is the constant value that represents an idle pinger thread. |
private FifoQueue |
m_addressQ
The queue of inbound addresses to poll. |
private long |
m_fiberId
The identifier for the fiber. |
private short |
m_icmpId
The value stored in the icmp identifier field. |
private QuantumSemaphore |
m_semaphore
The semaphore that each poller must acquire before they can send a packet |
private boolean |
m_signaled
True if the signal method
is invoked. |
private IcmpSocket |
m_socket
The socket used to send datagrams. |
private int |
m_status
The normal fiber's status. |
private java.net.InetAddress |
m_target
The current target address. |
private java.lang.Thread |
m_worker
The thread that is executing the run
method on behalf of the fiber. |
private int |
m_xstatus
The extended status. |
(package private) static int |
POLLING
This is the constant value that represents a polling pinger thread. |
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.Pinger(IcmpSocket socket,
QuantumSemaphore semaphore,
FifoQueue addrQ,
short filterId,
long tid)
Constructs a new instance of a pinging fiber. |
Method Summary | |
int |
getExtendedStatus()
Returns the extends status of the thread. |
long |
getId()
Returns the identifier that is placed in the ping packet . |
java.lang.String |
getName()
Returns the name of the fiber. |
int |
getStatus()
Returns the current status of the pinging thread. |
boolean |
isPinging(java.net.InetAddress addr)
Returns true if this thread is currently polling the passed IP Address. |
void |
pause()
Pauses the current fiber. |
private boolean |
poll(IPPollAddress addr)
This method does the actual polling of the encapsulated address using the timeout and retry values. |
void |
resume()
Resumes a currently paused fiber. |
void |
run()
The main method that does the work for the pinging thread. |
void |
signal()
Signals the instance that it's current target has responded to an echo check. |
void |
start()
Starts the current fiber. |
void |
stop()
Attempts to stop the current polling cycle as quickly as possbile. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private final QuantumSemaphore m_semaphore
private final IcmpSocket m_socket
private final FifoQueue m_addressQ
private final short m_icmpId
private final long m_fiberId
private int m_status
private int m_xstatus
private java.net.InetAddress m_target
private boolean m_signaled
signal
method
is invoked. Used to indicate a responsive
address.
private java.lang.Thread m_worker
run
method on behalf of the fiber.
static final int IDLE
static final int POLLING
Constructor Detail |
PingManager.Pinger(IcmpSocket socket, QuantumSemaphore semaphore, FifoQueue addrQ, short filterId, long tid)
socket
- The ICMP socketsemaphore
- The control semaphoreaddrQ
- The input address queue.filterId
- The ICMP id for filtering datagramstid
- The Thread ID stored in the Packet.Method Detail |
private boolean poll(IPPollAddress addr) throws java.io.IOException, java.lang.InterruptedException
This method does the actual polling of the encapsulated address using the timeout and retry values. The polling will continue until either all the retries are exhausted or the pinger is signaled that the address responded.
NOTICE: The instance lock must be heald prior
to calling this method. This method uses the
wait
method and lock ownership
is required to invoke the wait
method.
addr
- The address and information for polling.
java.io.IOException
- Thrown if an error occurs sending
the ICMP information.
java.lang.InterruptedException
- Thrown if the thread
is interrupted.public void start()
start
in interface Fiber
java.lang.IllegalStateException
- Thrown if the
fiber has already been started.public void stop()
IllegalStateExceptio
is generated.
stop
in interface Fiber
java.lang.IllegalStateException
- Thrown if the fiber has
never been started.public void pause()
Pauses the current fiber. This does not take effect immediently, but after the current polling cycle has completed.
To determine if the fiber has finished its
current polling cycle check for a status equal
to PAUSED
and the extended status
equal to IDLE
.
pause
in interface PausableFiber
public void resume()
resume
in interface PausableFiber
public java.lang.String getName()
getName
in interface Fiber
public int getStatus()
getStatus
in interface Fiber
public int getExtendedStatus()
getExtendedStatus
in interface ExtendedStatusFiber
public void run()
The main method that does the work for the pinging
thread. This method reads IPPollAddress
instances from the input queue and then polls the
target using the information.
While a poll is in process the extended status of the
fiber will return POLLING
otherwise it
should be IDLE
.
If an error occurs then the thread will exit and set
the status to STOPPED
.
run
in interface java.lang.Runnable
public boolean isPinging(java.net.InetAddress addr)
addr
- The address to check.
public void signal()
public long getId()
packet
.
|
OpenNMS API 1.1.4 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |