- java.lang.Object
-
- java.util.EventObject
-
- org.snmp4j.transport.TransportStateEvent
-
- All Implemented Interfaces:
java.io.Serializable
public class TransportStateEvent extends java.util.EventObject
TheTransportStateEvent
describes a state change for a transport connection. Optionally, connection establishment can be cancelled.- Since:
- 1.7
- Version:
- 2.4
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
cancelled
private java.io.IOException
causingException
private java.util.ArrayList<byte[]>
discardedMessages
private int
newState
private Address
peerAddress
private static long
serialVersionUID
static int
STATE_CLOSED
static int
STATE_CONNECTED
static int
STATE_DISCONNECTED_REMOTELY
static int
STATE_DISCONNECTED_TIMEOUT
static int
STATE_UNKNOWN
-
Constructor Summary
Constructors Constructor Description TransportStateEvent(AbstractTransportMapping<?> source, Address peerAddress, int newState, java.io.IOException causingException)
TransportStateEvent(AbstractTransportMapping<?> source, Address peerAddress, int newState, java.io.IOException causingException, java.util.List<byte[]> discardedMessages)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.io.IOException
getCausingException()
java.util.List<byte[]>
getDiscardedMessages()
Gets the messages that were discarded due to a state change of the transport connection.int
getNewState()
Address
getPeerAddress()
boolean
isCancelled()
Indicates whether this event has been canceled.void
setCancelled(boolean cancelled)
Sets the canceled state of the transport event.java.lang.String
toString()
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
STATE_UNKNOWN
public static final int STATE_UNKNOWN
- See Also:
- Constant Field Values
-
STATE_CONNECTED
public static final int STATE_CONNECTED
- See Also:
- Constant Field Values
-
STATE_DISCONNECTED_REMOTELY
public static final int STATE_DISCONNECTED_REMOTELY
- See Also:
- Constant Field Values
-
STATE_DISCONNECTED_TIMEOUT
public static final int STATE_DISCONNECTED_TIMEOUT
- See Also:
- Constant Field Values
-
STATE_CLOSED
public static final int STATE_CLOSED
- See Also:
- Constant Field Values
-
newState
private int newState
-
peerAddress
private Address peerAddress
-
causingException
private java.io.IOException causingException
-
discardedMessages
private java.util.ArrayList<byte[]> discardedMessages
-
cancelled
private boolean cancelled
-
-
Constructor Detail
-
TransportStateEvent
public TransportStateEvent(AbstractTransportMapping<?> source, Address peerAddress, int newState, java.io.IOException causingException)
-
TransportStateEvent
public TransportStateEvent(AbstractTransportMapping<?> source, Address peerAddress, int newState, java.io.IOException causingException, java.util.List<byte[]> discardedMessages)
-
-
Method Detail
-
getCausingException
public java.io.IOException getCausingException()
-
getNewState
public int getNewState()
-
getPeerAddress
public Address getPeerAddress()
-
getDiscardedMessages
public java.util.List<byte[]> getDiscardedMessages()
Gets the messages that were discarded due to a state change of the transport connection.- Returns:
- a (possibly empty) list of messages that were discarded or
null
if the event has not terminated the transport connection. - Since:
- 2.4.0
-
isCancelled
public boolean isCancelled()
Indicates whether this event has been canceled. OnlySTATE_CONNECTED
events can be canceled.- Returns:
true
if the event has been canceled.- Since:
- 1.8
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.util.EventObject
-
setCancelled
public void setCancelled(boolean cancelled)
Sets the canceled state of the transport event. OnlySTATE_CONNECTED
events can be canceled.- Parameters:
cancelled
-true
if the event should be canceled, i.e. a connection attempt should be rejected.- Since:
- 1.8
-
-