--- source-trees/wsrf-cvs/ws-transfer/reliable/service/java/source/src/org/globus/transfer/reliable/service/cache/SingleConnectionImpl.java 15 Mar 2008 15:19:47 -0000 1.1.6.3 +++ source-trees/wsrf-cvs/ws-transfer/reliable/service/java/source/src/org/globus/transfer/reliable/service/cache/SingleConnectionImpl.java 6 May 2008 17:19:47 -0000 1.1.6.3.2.1 @@ -40,7 +40,7 @@ protected String userDN; protected long lastUsed; protected String path; - protected int hashCode; + protected String connectionId; protected int type; protected boolean supportsRDEL; @@ -65,7 +65,7 @@ super(params.getSourceHost(),params.getSourcePort()); RFTOptionsType rftOptions = params.getRFTOptions(); - this.hashCode = params.hashCode(); + this.connectionId = params.getConnectionId(); this.path = params.getSourcePath(); this.userDN = params.getUserDN(); @@ -335,12 +335,12 @@ } /** - * Check if this client can be reused. + * Check if the existing connection can be reused. + * @return true in case the connection can be reused */ public boolean checkForReuse (ConnectionParameter params) { - return (this.hashCode == params.hashCode() && - this.userDN.equals(params.getUserDN())); + return (this.connectionId.equals(params.getConnectionId())); } public int getType() --- source-trees/wsrf-cvs/ws-transfer/reliable/service/java/source/src/org/globus/transfer/reliable/service/cache/ConnectionParameter.java 15 Mar 2008 15:19:47 -0000 1.1.6.3 +++ source-trees/wsrf-cvs/ws-transfer/reliable/service/java/source/src/org/globus/transfer/reliable/service/cache/ConnectionParameter.java 6 May 2008 17:19:47 -0000 1.1.6.3.2.1 @@ -3,7 +3,6 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.globus.rft.generated.RFTOptionsType; -import org.globus.transfer.reliable.service.MyPerformanceLog; import org.globus.transfer.reliable.service.exception.RftException; public class ConnectionParameter @@ -23,7 +22,7 @@ private int sourcePort; private int destinationPort; private int type; - private int hashCode; + private String connectionId; public ConnectionParameter( String sourceHost, @@ -49,8 +48,8 @@ this.destinationHost = null; this.destinationPort = 0; this.destinationPath = null; - // generate hashCode - this.createHashCode(); + // create connectionId + this.createConnectionId(); } public ConnectionParameter( @@ -81,8 +80,8 @@ } this.userDN = userDN; this.rftOptions = rftOptions; - // generate hashCode - this.createHashCode(); + // create connectionId + this.createConnectionId(); } public int getType() @@ -130,36 +129,31 @@ return this.rftOptions; } - public int hashCode() + public String getConnectionId() { - return this.hashCode; + return this.connectionId; } /** - * Create a hash value of all parameters except for the paths which + * Create a connection id of all parameters except for the paths which * are not needed in the check for reuse. */ - private void createHashCode() + private void createConnectionId() { - long startTime = 0; - if (logger.isDebugEnabled()) { - startTime = System.currentTimeMillis(); - } + StringBuffer buffer = new StringBuffer(); + buffer.append(userDN); + buffer.append(sourceHost); + buffer.append(sourcePort); + buffer.append(rftOptions.hashCode()); - this.hashCode = sourceHost.hashCode(); - this.hashCode = sourcePort ^ this.hashCode; - this.hashCode = userDN.hashCode() ^ this.hashCode; - this.hashCode = rftOptions.hashCode() ^ this.hashCode; - - if (this.type == DOUBLE_TYPE) - { - this.hashCode = destinationHost.hashCode() ^ this.hashCode; - this.hashCode = destinationPort ^ this.hashCode; + if (this.type == DOUBLE_TYPE) { + buffer.append(destinationHost); + buffer.append(destinationPort); } + + this.connectionId = buffer.toString(); if (logger.isDebugEnabled()) { - logger.debug("hashCode of connection: " + hashCode); - logger.debug("time to create the hashCode: " + - (System.currentTimeMillis() - startTime) + "ms"); + logger.debug("id of connection: " + connectionId); } } } --- source-trees/wsrf-cvs/ws-transfer/reliable/service/java/source/src/org/globus/transfer/reliable/service/cache/ThirdPartyConnectionImpl.java 15 Mar 2008 15:19:47 -0000 1.1.6.3 +++ source-trees/wsrf-cvs/ws-transfer/reliable/service/java/source/src/org/globus/transfer/reliable/service/cache/ThirdPartyConnectionImpl.java 6 May 2008 17:19:47 -0000 1.1.6.3.2.1 @@ -20,7 +20,7 @@ protected SingleConnectionImpl destination; protected String userDN; protected long lastUsed; - protected int hashCode; + protected String connectionId; protected int type; private static final int numberFDs = 2; @@ -116,7 +116,7 @@ } } - this.hashCode = params.hashCode(); + this.connectionId = params.getConnectionId(); this.type = ConnectionManager.THIRDPARTY_CONNECTION; } @@ -142,18 +142,13 @@ } /** - * Check if the existing connection can be reused for another transfer. - * Sanity security check: compare the subjects, just in case the hashCode - * creation code has problems. - * @param transferJob - * @param rftOptions + * Check if the existing connection can be reused. * @return true in case the connection can be reused */ public boolean checkForReuse ( ConnectionParameter params) { - return (this.hashCode == params.hashCode() && - this.userDN.equals(params.getUserDN())); + return (this.connectionId.equals(params.getConnectionId())); } /** --- source-trees/wsrf-cvs/ws-transfer/reliable/service/java/source/pkgdata/pkg_data_src.gpt 21 Mar 2008 19:13:24 -0000 1.25.4.19 +++ source-trees/wsrf-cvs/ws-transfer/reliable/service/java/source/pkgdata/pkg_data_src.gpt 6 May 2008 17:19:48 -0000 1.25.4.19.2.1 @@ -3,7 +3,7 @@ - + GT4 Reliable File Transfer Data