[Jboss-cvs] JBossAS SVN: r55927 - branches/JBoss_3_2_7_CP/server/src/main/org/jboss/invocation/pooled/interfaces
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Aug 14 21:38:55 EDT 2006
Author: ryan.campbell at jboss.com
Date: 2006-08-14 21:38:54 -0400 (Mon, 14 Aug 2006)
New Revision: 55927
Modified:
branches/JBoss_3_2_7_CP/server/src/main/org/jboss/invocation/pooled/interfaces/ServerAddress.java
Log:
merged JBAS-3166:Port JBAS-3089 fix to 3.2.7
Modified: branches/JBoss_3_2_7_CP/server/src/main/org/jboss/invocation/pooled/interfaces/ServerAddress.java
===================================================================
--- branches/JBoss_3_2_7_CP/server/src/main/org/jboss/invocation/pooled/interfaces/ServerAddress.java 2006-08-15 01:29:48 UTC (rev 55926)
+++ branches/JBoss_3_2_7_CP/server/src/main/org/jboss/invocation/pooled/interfaces/ServerAddress.java 2006-08-15 01:38:54 UTC (rev 55927)
@@ -9,6 +9,7 @@
package org.jboss.invocation.pooled.interfaces;
import java.io.Serializable;
+import java.io.IOException;
import javax.net.SocketFactory;
/**
@@ -27,7 +28,7 @@
private static final long serialVersionUID = -7206359745950445445L;
/**
- * Address of host ot connect to
+ * Address of host to connect to
*/
public String address;
@@ -45,7 +46,10 @@
* Timeout of setSoTimeout
*/
public int timeout = 60000;
-
+
+ /**
+ * An optional socket factory for connecting to the server
+ */
public SocketFactory clientSocketFactory;
/**
@@ -54,6 +58,15 @@
*/
private transient int hashCode;
+ /**
+ * The server address/port representation.
+ *
+ * @param address - hostname/ip of the server
+ * @param port - the invoker port
+ * @param enableTcpNoDelay - the Socket.setTcpNoDelay flag
+ * @param timeout - the Socket.setSoTimeout value
+ * @param clientSocketFactory - optional SocketFactory
+ */
public ServerAddress(String address, int port, boolean enableTcpNoDelay,
int timeout, SocketFactory clientSocketFactory)
{
@@ -61,6 +74,8 @@
this.port = port;
this.enableTcpNoDelay = enableTcpNoDelay;
this.hashCode = address.hashCode() + port;
+ if( enableTcpNoDelay )
+ this.hashCode ++;
this.timeout = timeout;
this.clientSocketFactory = clientSocketFactory;
}
@@ -74,15 +89,14 @@
{
try
{
+ // Compare this to obj
ServerAddress o = (ServerAddress) obj;
- if (o.hashCode != hashCode)
+ if (port != o.port)
return false;
- if (port != port)
+ if (address.equals(o.address) == false)
return false;
- if (!o.address.equals(address))
+ if (enableTcpNoDelay != o.enableTcpNoDelay)
return false;
- if (o.enableTcpNoDelay != enableTcpNoDelay)
- return false;
return true;
}
catch (Throwable e)
@@ -96,4 +110,20 @@
return hashCode;
}
+ /**
+ * Create the transient hashCode
+ * @param in
+ * @throws IOException
+ * @throws ClassNotFoundException
+ */
+ private void readObject(java.io.ObjectInputStream in)
+ throws IOException, ClassNotFoundException
+ {
+ // Trigger default serialization
+ in.defaultReadObject();
+ // Build the hashCode
+ this.hashCode = address.hashCode() + port;
+ if( enableTcpNoDelay )
+ this.hashCode ++;
+ }
}
More information about the jboss-cvs-commits
mailing list