Package org.opennms.netmgt.icmp.jni
Class JniPingRequest
- java.lang.Object
-
- org.opennms.netmgt.icmp.jni.JniPingRequest
-
- All Implemented Interfaces:
Comparable<Delayed>
,Delayed
,EchoPacket
,org.opennms.protocols.rt.Request<JniPingRequestId,JniPingRequest,JniPingResponse>
public class JniPingRequest extends Object implements org.opennms.protocols.rt.Request<JniPingRequestId,JniPingRequest,JniPingResponse>, EchoPacket
This class is used to encapsulate a ping request. A request consist of the pingable address and a signaled state.- Author:
- Ben Reed, Mathew Brozowski
-
-
Constructor Summary
Constructors Constructor Description JniPingRequest(InetAddress addr, int identifier, int sequenceNumber, long timeout, int retries, int packetsize, PingResponseCallback cb)
JniPingRequest(InetAddress addr, int identifier, int sequenceNumber, long threadId, long timeout, int retries, int packetsize, PingResponseCallback cb)
JniPingRequest(JniPingRequestId id, long timeout, int retries, int packetsize, PingResponseCallback callback)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(Delayed request)
compareTodouble
elapsedTime(TimeUnit timeUnit)
Returns the round trip time in the requested TimeUnit (note that a fractional value will be returned if necessary)long
getDelay(TimeUnit unit)
JniPingRequestId
getId()
getIdint
getIdentifier()
static long
getNextTID()
long
getReceivedTimeNanos()
long
getSentTimeNanos()
int
getSequenceNumber()
long
getThreadId()
boolean
isEchoReply()
boolean
isExpired()
isExpiredboolean
isProcessed()
isProcessedvoid
processError(Throwable t)
boolean
processResponse(JniPingResponse reply)
processResponseJniPingRequest
processTimeout()
processTimeoutvoid
send(org.opennms.protocols.icmp.IcmpSocket icmpSocket)
Send this JniPingRequest through the given icmpSocketString
toString()
toString
-
-
-
Constructor Detail
-
JniPingRequest
public JniPingRequest(JniPingRequestId id, long timeout, int retries, int packetsize, PingResponseCallback callback)
-
JniPingRequest
public JniPingRequest(InetAddress addr, int identifier, int sequenceNumber, long threadId, long timeout, int retries, int packetsize, PingResponseCallback cb)
-
JniPingRequest
public JniPingRequest(InetAddress addr, int identifier, int sequenceNumber, long timeout, int retries, int packetsize, PingResponseCallback cb)
-
-
Method Detail
-
getNextTID
public static final long getNextTID()
-
processResponse
public boolean processResponse(JniPingResponse reply)
processResponse
- Specified by:
processResponse
in interfaceorg.opennms.protocols.rt.Request<JniPingRequestId,JniPingRequest,JniPingResponse>
- Parameters:
reply
- aorg.opennms.netmgt.icmp.spi.JniPingResponse.PingReply
object.- Returns:
- a boolean.
-
processTimeout
public JniPingRequest processTimeout()
processTimeout
- Specified by:
processTimeout
in interfaceorg.opennms.protocols.rt.Request<JniPingRequestId,JniPingRequest,JniPingResponse>
- Returns:
- a
JniPingRequest
object.
-
isExpired
public boolean isExpired()
isExpired
- Returns:
- a boolean.
-
toString
public String toString()
toString
-
getDelay
public long getDelay(TimeUnit unit)
- Specified by:
getDelay
in interfaceDelayed
- Specified by:
getDelay
in interfaceorg.opennms.protocols.rt.Request<JniPingRequestId,JniPingRequest,JniPingResponse>
-
compareTo
public int compareTo(Delayed request)
compareTo
- Specified by:
compareTo
in interfaceComparable<Delayed>
- Parameters:
request
- aDelayed
object.- Returns:
- a int.
-
getId
public JniPingRequestId getId()
getId
- Specified by:
getId
in interfaceorg.opennms.protocols.rt.Request<JniPingRequestId,JniPingRequest,JniPingResponse>
- Returns:
- a
org.opennms.netmgt.icmp.spi.JniPingRequestId.PingRequestId
object.
-
processError
public void processError(Throwable t)
- Specified by:
processError
in interfaceorg.opennms.protocols.rt.Request<JniPingRequestId,JniPingRequest,JniPingResponse>
-
isProcessed
public boolean isProcessed()
isProcessed
- Specified by:
isProcessed
in interfaceorg.opennms.protocols.rt.Request<JniPingRequestId,JniPingRequest,JniPingResponse>
- Returns:
- a boolean.
-
send
public void send(org.opennms.protocols.icmp.IcmpSocket icmpSocket)
Send this JniPingRequest through the given icmpSocket- Parameters:
icmpSocket
- aIcmpSocket
object.
-
isEchoReply
public boolean isEchoReply()
- Specified by:
isEchoReply
in interfaceEchoPacket
-
getIdentifier
public int getIdentifier()
- Specified by:
getIdentifier
in interfaceEchoPacket
-
getSequenceNumber
public int getSequenceNumber()
- Specified by:
getSequenceNumber
in interfaceEchoPacket
-
getThreadId
public long getThreadId()
- Specified by:
getThreadId
in interfaceEchoPacket
-
getReceivedTimeNanos
public long getReceivedTimeNanos()
- Specified by:
getReceivedTimeNanos
in interfaceEchoPacket
-
getSentTimeNanos
public long getSentTimeNanos()
- Specified by:
getSentTimeNanos
in interfaceEchoPacket
-
elapsedTime
public double elapsedTime(TimeUnit timeUnit)
Description copied from interface:EchoPacket
Returns the round trip time in the requested TimeUnit (note that a fractional value will be returned if necessary)- Specified by:
elapsedTime
in interfaceEchoPacket
-
-