- java.lang.Object
-
- java.util.EventObject
-
- org.snmp4j.event.ResponseEvent<A>
-
- Type Parameters:
A- type of the peerAddress.
- All Implemented Interfaces:
java.io.Serializable
public class ResponseEvent<A extends Address> extends java.util.EventObjectResponseEventassociates a request PDU with the corresponding response and an optional user object.- Version:
- 3.1.0
- Author:
- Frank Fock
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ResponseEvent(java.lang.Object source, A peerAddress, PDU request, PDU response, java.lang.Object userObject)Creates anResponseEventinstance.ResponseEvent(java.lang.Object source, A peerAddress, PDU request, PDU response, java.lang.Object userObject, java.lang.Exception error)Creates anResponseEventinstance with an exception object indicating a message processing error.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.ExceptiongetError()Gets the exception object from the exception that has been generated when the request processing has failed due to an error.AgetPeerAddress()Gets the transport address of the response sender.PDUgetRequest()Gets the request PDU.PDUgetResponse()Gets the response PDU.java.lang.ObjectgetUserObject()Gets the user object that has been supplied to the asynchronous requestSession.send(PDU pdu, org.snmp4j.Target target, Object userHandle, ResponseListener listener).protected voidsetPeerAddress(A peerAddress)protected voidsetRequest(PDU request)protected voidsetResponse(PDU response)protected voidsetUserObject(java.lang.Object userObject)
-
-
-
Constructor Detail
-
ResponseEvent
public ResponseEvent(java.lang.Object source, A peerAddress, PDU request, PDU response, java.lang.Object userObject)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(java.lang.Object source, A peerAddress, PDU request, PDU response, java.lang.Object userObject, java.lang.Exception error)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.
-
-
Method Detail
-
getRequest
public PDU getRequest()
Gets the request PDU.- Returns:
- a
PDU.
-
setPeerAddress
protected final void setPeerAddress(A peerAddress)
-
setRequest
protected final void setRequest(PDU request)
-
setResponse
protected final void setResponse(PDU response)
-
getResponse
public PDU 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
protected final void setUserObject(java.lang.Object userObject)
-
getUserObject
public java.lang.Object 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
public java.lang.Exception 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
public A 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()).
-
-