java.lang.Object
java.util.TimerTask
org.snmp4j.Snmp.PendingRequest<A>
- All Implemented Interfaces:
Cloneable,Runnable,PduHandleCallback<PDU>
- Direct Known Subclasses:
Snmp.AsyncPendingRequest
- Enclosing class:
Snmp
protected class Snmp.PendingRequest<A extends Address>
extends TimerTask
implements PduHandleCallback<PDU>, Cloneable
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate booleanprivate PduHandleprotected ResponseListenerprivate intprivate PDUThenextPDUfield holds a PDU that has to be sent when the response of thepduhas been received.protected PDUprivate booleanprivate intprivate booleanprotected intprotected TransportMapping<? super A> protected Objectprivate CounterEventprivate CounterEvent -
Constructor Summary
ConstructorsModifierConstructorDescriptionPendingRequest(ResponseListener listener, Object userObject, PDU pdu, Target<A> target, TransportMapping<? super A> transport) privatePendingRequest(Snmp.PendingRequest<A> other) -
Method Summary
Modifier and TypeMethodDescriptionbooleancancel()Cancels the request and clears all internal fields by setting them tonull.clone()private voidintvoidinsertFirstPDU(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
-
key
-
retryCount
protected int retryCount -
listener
-
userObject
-
pdu
-
target
-
transport
-
requestStatus
private int requestStatus -
maxRequestStatus
private int maxRequestStatus -
finished
private volatile boolean finished -
responseReceived
private volatile boolean responseReceived -
pendingRetry
private volatile boolean pendingRetry -
cancelled
private volatile boolean cancelled -
waitTime
-
waitTimeTarget
-
nextPDU
ThenextPDUfield holds a PDU that has to be sent when the response of thepduhas been received. Usually, this is used for (context) engine ID discovery.
-
-
Constructor Details
-
PendingRequest
public PendingRequest(ResponseListener listener, Object userObject, PDU pdu, Target<A> target, TransportMapping<? super A> transport) -
PendingRequest
-
-
Method Details
-
discoverContextEngineID
private void discoverContextEngineID() -
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() -
cancel
public boolean cancel()Cancels the request and clears all internal fields by setting them tonull.
-