java.lang.Object
java.util.TimerTask
org.snmp4j.Snmp.PendingRequest<A>
- All Implemented Interfaces:
Cloneable
,Runnable
,PduHandleCallback<PDU>
- Enclosing class:
Snmp
protected class Snmp.PendingRequest<A extends Address>
extends TimerTask
implements PduHandleCallback<PDU>, Cloneable
-
Field Summary
Modifier and TypeFieldDescriptionprotected ResponseListener
protected PDU
protected int
protected TransportMapping
<? super A> protected Object
-
Constructor Summary
ConstructorDescriptionPendingRequest
(ResponseListener listener, Object userObject, PDU pdu, Target<A> target, TransportMapping<? super A> transport) -
Method Summary
Modifier and TypeMethodDescriptionboolean
cancel()
Cancels the request and clears all internal fields by setting them tonull
.clone()
long
Gets the nanoseconds waited for a response for this pending request.int
void
insertFirstPDU
(PDU firstPDU) boolean
void
pduHandleAssigned
(PduHandle handle, PDU pdu) A new PduHandle has been created for a PDU.protected void
registerRequest
(PduHandle handle) void
void
run()
Process retries of a pending request.boolean
void
setMaxRequestStatus
(int maxRequestStatus) void
setNextPDU
(PDU nextPDU) boolean
Methods inherited from class java.util.TimerTask
scheduledExecutionTime
-
Field Details
-
retryCount
protected int retryCount -
listener
-
userObject
-
pdu
-
target
-
transport
-
-
Constructor Details
-
PendingRequest
public PendingRequest(ResponseListener listener, Object userObject, PDU pdu, Target<A> target, TransportMapping<? super A> transport)
-
-
Method Details
-
registerRequest
-
useNextPDU
public boolean useNextPDU() -
insertFirstPDU
-
responseReceived
public void responseReceived() -
getNextPDU
-
setNextPDU
-
clone
- Overrides:
clone
in classObject
- Throws:
CloneNotSupportedException
-
pduHandleAssigned
Description copied from interface:PduHandleCallback
A new PduHandle has been created for a PDU. This event callback notification can be used to get informed about a new PduHandle (just) before a PDU has been sent out.- Specified by:
pduHandleAssigned
in interfacePduHandleCallback<A extends Address>
- Parameters:
handle
- aPduHandle
instance that uniquely identifies a request - thus in most cases the request ID.pdu
- the request PDU for which the handle has been created.
-
run
public void run()Process retries of a pending request. -
setFinished
public boolean setFinished() -
setMaxRequestStatus
public void setMaxRequestStatus(int maxRequestStatus) -
getMaxRequestStatus
public int getMaxRequestStatus() -
isResponseReceived
public boolean isResponseReceived() -
getDurationNanos
public long getDurationNanos()Gets the nanoseconds waited for a response for this pending request.- Returns:
- a value greater than 0 represents the nanoseconds
Snmp
waited until a response was received. - Since:
- 3.7.5
-
cancel
public boolean cancel()Cancels the request and clears all internal fields by setting them tonull
.
-