- java.lang.Object
-
- java.util.TimerTask
-
- org.snmp4j.Snmp.PendingRequest<A>
-
- All Implemented Interfaces:
java.lang.Cloneable
,java.lang.Runnable
,PduHandleCallback<PDU>
- Direct Known Subclasses:
Snmp.AsyncPendingRequest
- Enclosing class:
- Snmp
protected class Snmp.PendingRequest<A extends Address> extends java.util.TimerTask implements PduHandleCallback<PDU>, java.lang.Cloneable
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
cancelled
private boolean
finished
private PduHandle
key
protected ResponseListener
listener
private int
maxRequestStatus
private PDU
nextPDU
ThenextPDU
field holds a PDU that has to be sent when the response of thepdu
has been received.protected PDU
pdu
private boolean
pendingRetry
private int
requestStatus
private boolean
responseReceived
protected int
retryCount
protected Target<A>
target
protected TransportMapping<? super A>
transport
protected java.lang.Object
userObject
private CounterEvent
waitTime
private CounterEvent
waitTimeTarget
-
Constructor Summary
Constructors Modifier Constructor Description PendingRequest(ResponseListener listener, java.lang.Object userObject, PDU pdu, Target<A> target, TransportMapping<? super A> transport)
private
PendingRequest(Snmp.PendingRequest<A> other)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
cancel()
Cancels the request and clears all internal fields by setting them tonull
.java.lang.Object
clone()
private void
discoverContextEngineID()
int
getMaxRequestStatus()
PDU
getNextPDU()
void
insertFirstPDU(PDU firstPDU)
boolean
isResponseReceived()
void
pduHandleAssigned(PduHandle handle, PDU pdu)
A new PduHandle has been created for a PDU.protected void
registerRequest(PduHandle handle)
void
responseReceived()
void
run()
Process retries of a pending request.boolean
setFinished()
void
setMaxRequestStatus(int maxRequestStatus)
void
setNextPDU(PDU nextPDU)
boolean
useNextPDU()
-
-
-
Field Detail
-
key
private PduHandle key
-
retryCount
protected int retryCount
-
listener
protected ResponseListener listener
-
userObject
protected java.lang.Object userObject
-
pdu
protected PDU pdu
-
transport
protected TransportMapping<? super A extends Address> 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
private CounterEvent waitTime
-
waitTimeTarget
private CounterEvent waitTimeTarget
-
nextPDU
private PDU nextPDU
ThenextPDU
field holds a PDU that has to be sent when the response of thepdu
has been received. Usually, this is used for (context) engine ID discovery.
-
-
Constructor Detail
-
PendingRequest
public PendingRequest(ResponseListener listener, java.lang.Object userObject, PDU pdu, Target<A> target, TransportMapping<? super A> transport)
-
PendingRequest
private PendingRequest(Snmp.PendingRequest<A> other)
-
-
Method Detail
-
discoverContextEngineID
private void discoverContextEngineID()
-
registerRequest
protected void registerRequest(PduHandle handle)
-
useNextPDU
public boolean useNextPDU()
-
insertFirstPDU
public void insertFirstPDU(PDU firstPDU)
-
responseReceived
public void responseReceived()
-
getNextPDU
public PDU getNextPDU()
-
setNextPDU
public void setNextPDU(PDU nextPDU)
-
clone
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
- Overrides:
clone
in classjava.lang.Object
- Throws:
java.lang.CloneNotSupportedException
-
pduHandleAssigned
public void pduHandleAssigned(PduHandle handle, PDU pdu)
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.- Specified by:
run
in interfacejava.lang.Runnable
- Specified by:
run
in classjava.util.TimerTask
-
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
.- Overrides:
cancel
in classjava.util.TimerTask
- Returns:
true
if cancellation was successful.
-
-