public class ResponseEvent extends EventObject
ResponseEvent
associates a request PDU with the corresponding
response and an optional user object.source
Constructor and Description |
---|
ResponseEvent(Object source,
Address peerAddress,
PDU request,
PDU response,
Object userObject)
Creates an
ResponseEvent instance. |
ResponseEvent(Object source,
Address peerAddress,
PDU request,
PDU response,
Object userObject,
Exception error)
Creates an
ResponseEvent instance with an exception object
indicating a message processing error. |
Modifier and Type | Method and Description |
---|---|
Exception |
getError()
Gets the exception object from the exception that has been generated
when the request processing has failed due to an error.
|
Address |
getPeerAddress()
Gets the transport address of the response sender.
|
PDU |
getRequest()
Gets the request PDU.
|
PDU |
getResponse()
Gets the response PDU.
|
Object |
getUserObject()
Gets the user object that has been supplied to the asynchronous request
Session.send(PDU pdu, org.snmp4j.Target target, Object userHandle,
ResponseListener listener) . |
protected void |
setPeerAddress(Address peerAddress) |
protected void |
setRequest(PDU request) |
protected void |
setResponse(PDU response) |
protected void |
setUserObject(Object userObject) |
getSource, toString
public ResponseEvent(Object source, Address peerAddress, PDU request, PDU response, Object userObject)
ResponseEvent
instance.source
- the event source.peerAddress
- the transport address of the entity that send the response.request
- the request PDU (must not be null
).response
- the response PDU or null
if the request timed out.userObject
- an optional user object.public ResponseEvent(Object source, Address peerAddress, PDU request, PDU response, Object userObject, Exception error)
ResponseEvent
instance with an exception object
indicating a message processing error.source
- the event source.peerAddress
- the transport address of the entity that send the response.request
- the request PDU (must not be null
).response
- the response PDU or null
if the request timed out.userObject
- an optional user object.error
- an Exception
.public PDU getRequest()
PDU
.protected final void setPeerAddress(Address peerAddress)
protected final void setRequest(PDU request)
protected final void setResponse(PDU response)
public PDU getResponse()
null
will be returned.protected final void setUserObject(Object userObject)
public Object getUserObject()
Session.send(PDU pdu, org.snmp4j.Target target, Object userHandle,
ResponseListener listener)
.public Exception getError()
Exception
instance.public Address getPeerAddress()
Address
of the command responder that send
this response, or null
if no response has been received
within the time-out interval or if an error occured (see
getError()
).Copyright © 2018 SNMP4J.org. All rights reserved.