1 20 21 package org.snmp4j.transport; 22 23 import java.io.*; 24 import java.util.*; 25 26 import org.snmp4j.smi.*; 27 28 37 public class TransportStateEvent extends EventObject { 38 39 private static final long serialVersionUID = 6440139076579035559L; 40 41 public static final int STATE_UNKNOWN = 0; 42 public static final int STATE_CONNECTED = 1; 43 public static final int STATE_DISCONNECTED_REMOTELY = 2; 44 public static final int STATE_DISCONNECTED_TIMEOUT = 3; 45 public static final int STATE_CLOSED = 4; 46 47 private int newState; 48 private Address peerAddress; 49 private IOException causingException; 50 51 private boolean cancelled = false; 52 53 public TransportStateEvent(Object source, 54 Address peerAddress, 55 int newState, 56 IOException causingException) { 57 super(source); 58 this.newState = newState; 59 this.peerAddress = peerAddress; 60 this.causingException = causingException; 61 } 62 63 public IOException getCausingException() { 64 return causingException; 65 } 66 67 public int getNewState() { 68 return newState; 69 } 70 71 public Address getPeerAddress() { 72 return peerAddress; 73 } 74 75 82 public boolean isCancelled() { 83 return cancelled; 84 } 85 86 public String toString() { 87 return TransportStateEvent.class.getName()+"[source="+source+ 88 ",peerAddress="+peerAddress+ 89 ",newState="+newState+ 90 ",cancelled="+cancelled+ 91 ",causingException="+causingException+"]"; 92 } 93 94 102 public void setCancelled(boolean cancelled) { 103 this.cancelled = cancelled; 104 } 105 } 106 | Popular Tags |