Package org.opennms.netmgt.icmp.jni6
Class Jni6PingRequest
- java.lang.Object
-
- org.opennms.netmgt.icmp.jni6.Jni6PingRequest
-
- All Implemented Interfaces:
Comparable<Delayed>,Delayed,Request<Jni6PingRequestId,Jni6PingRequest,Jni6PingResponse>,EchoPacket
public class Jni6PingRequest extends Object implements Request<Jni6PingRequestId,Jni6PingRequest,Jni6PingResponse>, 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 Jni6PingRequest(Inet6Address addr, int identifier, int sequenceNumber, long timeout, int retries, int packetsize, PingResponseCallback cb)Jni6PingRequest(Inet6Address addr, int identifier, int sequenceNumber, long threadId, long timeout, int retries, int packetsize, PingResponseCallback cb)Jni6PingRequest(Jni6PingRequestId id, long timeout, int retries, int packetsize, PingResponseCallback callback)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(Delayed request)compareTodoubleelapsedTime(TimeUnit timeUnit)Returns the round trip time in the requested TimeUnit (note that a fractional value will be returned if necessary)longgetDelay(TimeUnit unit)Indicates how many units of time are remaining until this request times out.Jni6PingRequestIdgetId()getIdintgetIdentifier()static longgetNextTID()longgetReceivedTimeNanos()longgetSentTimeNanos()intgetSequenceNumber()longgetThreadId()booleanisEchoReply()booleanisExpired()isExpiredbooleanisProcessed()isProcessedvoidprocessError(Throwable t)If an error or exception occurs during processing of this request then processError is called with the error or exception object.booleanprocessResponse(Jni6PingResponse reply)processResponseJni6PingRequestprocessTimeout()processTimeoutvoidsend(org.opennms.protocols.icmp6.ICMPv6Socket socket)Send this JniPingRequest through the given icmpSocketStringtoString()toString
-
-
-
Constructor Detail
-
Jni6PingRequest
public Jni6PingRequest(Jni6PingRequestId id, long timeout, int retries, int packetsize, PingResponseCallback callback)
-
Jni6PingRequest
public Jni6PingRequest(Inet6Address addr, int identifier, int sequenceNumber, long threadId, long timeout, int retries, int packetsize, PingResponseCallback cb)
-
Jni6PingRequest
public Jni6PingRequest(Inet6Address 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(Jni6PingResponse reply)
processResponse
- Specified by:
processResponsein interfaceRequest<Jni6PingRequestId,Jni6PingRequest,Jni6PingResponse>- Parameters:
reply- aorg.opennms.netmgt.icmp.Jni6PingResponse.JniPingResponse.PingReplyobject.- Returns:
- a boolean.
-
processTimeout
public Jni6PingRequest processTimeout()
processTimeout
- Specified by:
processTimeoutin interfaceRequest<Jni6PingRequestId,Jni6PingRequest,Jni6PingResponse>- Returns:
- a
Jni6PingRequestobject.
-
isExpired
public boolean isExpired()
isExpired
- Returns:
- a boolean.
-
toString
public String toString()
toString
-
getDelay
public long getDelay(TimeUnit unit)
Indicates how many units of time are remaining until this request times out. Please note that this is the time REMAINING not the total timeout time. This method is inherited from Delayed- Specified by:
getDelayin interfaceDelayed- Specified by:
getDelayin interfaceRequest<Jni6PingRequestId,Jni6PingRequest,Jni6PingResponse>
-
compareTo
public int compareTo(Delayed request)
compareTo
- Specified by:
compareToin interfaceComparable<Delayed>- Parameters:
request- aDelayedobject.- Returns:
- a int.
-
getId
public Jni6PingRequestId getId()
getId
- Specified by:
getIdin interfaceRequest<Jni6PingRequestId,Jni6PingRequest,Jni6PingResponse>- Returns:
- a
org.opennms.netmgt.icmp.Jni6PingRequestId.JniPingRequestId.PingRequestIdobject.
-
processError
public void processError(Throwable t)
Description copied from interface:RequestIf an error or exception occurs during processing of this request then processError is called with the error or exception object.- Specified by:
processErrorin interfaceRequest<Jni6PingRequestId,Jni6PingRequest,Jni6PingResponse>
-
isProcessed
public boolean isProcessed()
isProcessed
- Specified by:
isProcessedin interfaceRequest<Jni6PingRequestId,Jni6PingRequest,Jni6PingResponse>- Returns:
- a boolean.
-
send
public void send(org.opennms.protocols.icmp6.ICMPv6Socket socket)
Send this JniPingRequest through the given icmpSocket- Parameters:
socket- aIcmpSocketobject.
-
isEchoReply
public boolean isEchoReply()
- Specified by:
isEchoReplyin interfaceEchoPacket
-
getIdentifier
public int getIdentifier()
- Specified by:
getIdentifierin interfaceEchoPacket
-
getSequenceNumber
public int getSequenceNumber()
- Specified by:
getSequenceNumberin interfaceEchoPacket
-
getThreadId
public long getThreadId()
- Specified by:
getThreadIdin interfaceEchoPacket
-
getReceivedTimeNanos
public long getReceivedTimeNanos()
- Specified by:
getReceivedTimeNanosin interfaceEchoPacket
-
getSentTimeNanos
public long getSentTimeNanos()
- Specified by:
getSentTimeNanosin interfaceEchoPacket
-
elapsedTime
public double elapsedTime(TimeUnit timeUnit)
Description copied from interface:EchoPacketReturns the round trip time in the requested TimeUnit (note that a fractional value will be returned if necessary)- Specified by:
elapsedTimein interfaceEchoPacket
-
-