org.opennms.sms.ping.internal
Class PingRequest

java.lang.Object
  extended by org.opennms.sms.ping.internal.PingRequest
All Implemented Interfaces:
Comparable<Delayed>, Delayed, org.opennms.protocols.rt.Request<PingRequestId,PingRequest,PingReply>

public final class PingRequest
extends Object
implements org.opennms.protocols.rt.Request<PingRequestId,PingRequest,PingReply>

This class is used to encapsulate a ping request. A request consist of the pingable address and a signaled state.

Version:
$Id: $
Author:
Ben Reed, Mathew Brozowski, Ben Reed, Mathew Brozowski

Constructor Summary
PingRequest(PingRequestId id, long timeout, int retries, PingResponseCallback cb)
          Constructor for PingRequest.
 
Method Summary
 int compareTo(Delayed request)
          compareTo
 long getDelay(TimeUnit unit)
          
 long getExpiration()
          getExpiration
 PingRequestId getId()
          getId
 org.smslib.OutboundMessage getRequest()
          getRequest
 org.smslib.InboundMessage getResponse()
          getResponse
 int getRetries()
          getRetries
 long getRoundTripTime()
          getRoundTripTime
 long getTimeout()
          getTimeout
 boolean isExpired()
          isExpired
 boolean isProcessed()
          isProcessed
 void processError(Throwable t)
          
 boolean processResponse(PingReply reply)
          processResponse
 PingRequest processTimeout()
          processTimeout
 void setResponseTimestamp(Long millis)
          setResponseTimestamp
 void setSentTimestamp(Long millis)
          setSentTimestamp
 String toString()
          toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PingRequest

public PingRequest(PingRequestId id,
                   long timeout,
                   int retries,
                   PingResponseCallback cb)

Constructor for PingRequest.

Parameters:
id - a PingRequestId object.
timeout - a long.
retries - a int.
cb - a PingResponseCallback object.
Method Detail

getId

public PingRequestId getId()

getId

Specified by:
getId in interface org.opennms.protocols.rt.Request<PingRequestId,PingRequest,PingReply>
Returns:
a PingRequestId object.

getRetries

public int getRetries()

getRetries

Returns:
a int.

getTimeout

public long getTimeout()

getTimeout

Returns:
a long.

getRequest

public org.smslib.OutboundMessage getRequest()

getRequest

Returns:
a OutboundMessage object.

getResponse

public org.smslib.InboundMessage getResponse()

getResponse

Returns:
a InboundMessage object.

getExpiration

public long getExpiration()

getExpiration

Returns:
a long.

processResponse

public boolean processResponse(PingReply reply)

processResponse

Specified by:
processResponse in interface org.opennms.protocols.rt.Request<PingRequestId,PingRequest,PingReply>
Parameters:
reply - a PingReply object.
Returns:
a boolean.

processTimeout

public PingRequest processTimeout()

processTimeout

Specified by:
processTimeout in interface org.opennms.protocols.rt.Request<PingRequestId,PingRequest,PingReply>
Returns:
a PingRequest object.

isExpired

public boolean isExpired()

isExpired

Returns:
a boolean.

toString

public String toString()

toString

Overrides:
toString in class Object
Returns:
a String object.

getDelay

public long getDelay(TimeUnit unit)

Specified by:
getDelay in interface Delayed
Specified by:
getDelay in interface org.opennms.protocols.rt.Request<PingRequestId,PingRequest,PingReply>

compareTo

public int compareTo(Delayed request)

compareTo

Specified by:
compareTo in interface Comparable<Delayed>
Parameters:
request - a Delayed object.
Returns:
a int.

processError

public void processError(Throwable t)

Specified by:
processError in interface org.opennms.protocols.rt.Request<PingRequestId,PingRequest,PingReply>

setSentTimestamp

public void setSentTimestamp(Long millis)

setSentTimestamp

Parameters:
millis - a Long object.

setResponseTimestamp

public void setResponseTimestamp(Long millis)

setResponseTimestamp

Parameters:
millis - a Long object.

getRoundTripTime

public long getRoundTripTime()

getRoundTripTime

Returns:
a long.

isProcessed

public boolean isProcessed()

isProcessed

Specified by:
isProcessed in interface org.opennms.protocols.rt.Request<PingRequestId,PingRequest,PingReply>
Returns:
a boolean.


Copyright © 2011. All Rights Reserved.