1 9 package org.jboss.remoting.transport.socket; 10 11 import java.io.Serializable ; 12 13 23 public class ServerAddress implements Serializable 24 { 25 28 private static final long serialVersionUID = -7206359745950445445L; 29 30 33 public String address; 34 35 38 public int port; 39 40 43 public boolean enableTcpNoDelay = false; 44 45 48 public int timeout = 60000; 49 50 54 private transient int hashCode; 55 56 public ServerAddress(String address, int port, boolean enableTcpNoDelay, int timeout) 57 { 58 this.address = address; 59 this.port = port; 60 this.enableTcpNoDelay = enableTcpNoDelay; 61 this.hashCode = address.hashCode() + port; 62 this.timeout = timeout; 63 } 64 65 public String toString() 66 { 67 return "[address:" + address + ",port:" + port + ",enableTcpNoDelay:" + enableTcpNoDelay + "]"; 68 } 69 70 public boolean equals(Object obj) 71 { 72 try 73 { 74 ServerAddress o = (ServerAddress) obj; 75 if(o.hashCode != hashCode) 76 { 77 return false; 78 } 79 if(port != port) 80 { 81 return false; 82 } 83 if(!o.address.equals(address)) 84 { 85 return false; 86 } 87 if(o.enableTcpNoDelay != enableTcpNoDelay) 88 { 89 return false; 90 } 91 return true; 92 } 93 catch(Throwable e) 94 { 95 return false; 96 } 97 } 98 99 public int hashCode() 100 { 101 return hashCode; 102 } 103 104 } 105 | Popular Tags |