com.veraxsystems.icmp.ping.handlers
Class Receiver

java.lang.Object
  extended by com.veraxsystems.icmp.ping.handlers.Receiver
All Implemented Interfaces:
java.lang.Runnable

public class Receiver
extends java.lang.Object
implements java.lang.Runnable

An ICMP receiving thread implementation. The class is a {link IcmpJniBridge} receiver used in Ping class. It handles list of ICMP requests that are registered by registerRequest method. It receives ICMP responses and for those ones that matches registered requests, executes request result handler. The requests timeout condition is handled as well, so timeout handler is executed for requests that passes their end time.


Constructor Summary
Receiver(IcmpJniBridge icmpVal)
          Constructor accepts IcmpJniBridge object that is used to receive ICMP messages.
 
Method Summary
 void registerRequest(PingRequest request)
          Register ICMP EchoRequest and put it into requests queue.
 void run()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Receiver

public Receiver(IcmpJniBridge icmpVal)
Constructor accepts IcmpJniBridge object that is used to receive ICMP messages.

Parameters:
icmpVal - ICMP socket
Method Detail

registerRequest

public void registerRequest(PingRequest request)
                     throws PingErrorException
Register ICMP EchoRequest and put it into requests queue. Because the queue is sorted by end time so the first request is the one with the soonest timeout condition. This feature is used to handle request timeouts in proper order.

Parameters:
request - the ICMP descriptor
Throws:
PingErrorException - exception is thrown if Receiver object is disposed

run

public void run()
Specified by:
run in interface java.lang.Runnable