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
FieldsModifier and TypeFieldDescriptionprotected ResponseListenerprotected PDUprotected intprotected TransportMapping<? super A> protected Object -
Constructor Summary
ConstructorsConstructorDescriptionPendingRequest(ResponseListener listener, Object userObject, PDU pdu, Target<A> target, TransportMapping<? super A> transport) -
Method Summary
Modifier and TypeMethodDescriptionbooleancancel()Cancels the request and clears all internal fields by setting them tonull.clone()longGets the nanoseconds waited for a response for this pending request.intvoidinsertFirstPDU(PDU firstPDU) booleanvoidpduHandleAssigned(PduHandle handle, PDU pdu) A new PduHandle has been created for a PDU.protected voidregisterRequest(PduHandle handle) voidvoidrun()Process retries of a pending request.booleanvoidsetMaxRequestStatus(int maxRequestStatus) voidsetNextPDU(PDU nextPDU) booleanMethods 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:
clonein classObject- Throws:
CloneNotSupportedException
-
pduHandleAssigned
Description copied from interface:PduHandleCallbackA 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:
pduHandleAssignedin interfacePduHandleCallback<A extends Address>- Parameters:
handle- aPduHandleinstance 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
Snmpwaited 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.
-