java.lang.Object
java.util.EventObject
org.snmp4j.event.ResponseEvent<A>
- Type Parameters:
A- type of the peerAddress.
- All Implemented Interfaces:
Serializable
ResponseEvent associates a request PDU with the corresponding
response and an optional user object.- Version:
- 3.7.5
- Author:
- Frank Fock
- See Also:
-
Field Summary
Fields inherited from class java.util.EventObject
source -
Constructor Summary
ConstructorsConstructorDescriptionDeprecated.ResponseEvent(Object source, A peerAddress, PDU request, PDU response, Object userObject, long durationNanos) Creates anResponseEventinstance.ResponseEvent(Object source, A peerAddress, PDU request, PDU response, Object userObject, Exception error, long durationNanos) Creates anResponseEventinstance with an exception object indicating a message processing error. -
Method Summary
Modifier and TypeMethodDescriptionlongGets the nanoseconds waited between request and response.getError()Gets the exception object from the exception that has been generated when the request processing has failed due to an error.Gets the transport address of the response sender.Gets the request PDU.Gets the response PDU.Gets the user object that has been supplied to the asynchronous requestSession.send(PDU pdu, org.snmp4j.Target target, Object userHandle, ResponseListener listener).protected final voidsetPeerAddress(A peerAddress) protected final voidsetRequest(PDU request) protected final voidsetResponse(PDU response) protected final voidsetUserObject(Object userObject) Methods inherited from class java.util.EventObject
getSource, toString
-
Constructor Details
-
ResponseEvent
@Deprecated public ResponseEvent(Object source, A peerAddress, PDU request, PDU response, Object userObject) Deprecated.Please useResponseEvent(Object, Address, PDU, PDU, Object, long)instead.Creates anResponseEventinstance.- Parameters:
source- the event source.peerAddress- the transport address of the entity that send the response.request- the request PDU (must not benull).response- the response PDU ornullif the request timed out.userObject- an optional user object.
-
ResponseEvent
public ResponseEvent(Object source, A peerAddress, PDU request, PDU response, Object userObject, long durationNanos) Creates anResponseEventinstance.- Parameters:
source- the event source.peerAddress- the transport address of the entity that send the response.request- the request PDU (must not benull).response- the response PDU ornullif the request timed out.userObject- an optional user object.durationNanos- duration of receiving the response for provided request in nanoseconds.
-
ResponseEvent
public ResponseEvent(Object source, A peerAddress, PDU request, PDU response, Object userObject, Exception error, long durationNanos) Creates anResponseEventinstance with an exception object indicating a message processing error.- Parameters:
source- the event source.peerAddress- the transport address of the entity that send the response.request- the request PDU (must not benull).response- the response PDU ornullif the request timed out.userObject- an optional user object.error- anException.durationNanos- duration of receiving the response for provided request in nanoseconds.
-
-
Method Details
-
getRequest
Gets the request PDU.- Returns:
- a
PDU.
-
setPeerAddress
-
setRequest
-
setResponse
-
getResponse
Gets the response PDU.- Returns:
- a PDU instance if a response has been received. If the request timed out then
nullwill be returned.
-
setUserObject
-
getUserObject
Gets the user object that has been supplied to the asynchronous requestSession.send(PDU pdu, org.snmp4j.Target target, Object userHandle, ResponseListener listener).- Returns:
- an Object.
-
getError
Gets the exception object from the exception that has been generated when the request processing has failed due to an error.- Returns:
- an
Exceptioninstance.
-
getPeerAddress
Gets the transport address of the response sender.- Returns:
- the transport
Addressof the command responder that send this response, ornullif no response has been received within the time-out interval or if an error occured (seegetError()).
-
getDurationNanos
public long getDurationNanos()Gets the nanoseconds waited between request and response.- Returns:
- a value greater than 0 represents the nanoseconds
Snmpwaited until the response was received. - Since:
- 3.7.5
-
ResponseEvent(Object, Address, PDU, PDU, Object, long)instead.