You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by se...@apache.org on 2004/02/26 01:22:27 UTC

cvs commit: jakarta-jmeter/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/util DBKey.java

sebb        2004/02/25 16:22:27

  Modified:    src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/util
                        DBKey.java
  Log:
  Calculate hashCode in constructor
  
  Revision  Changes    Path
  1.10      +7 -6      jakarta-jmeter/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/util/DBKey.java
  
  Index: DBKey.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jmeter/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/util/DBKey.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- DBKey.java	12 Feb 2004 00:33:56 -0000	1.9
  +++ DBKey.java	26 Feb 2004 00:22:27 -0000	1.10
  @@ -20,7 +20,7 @@
   
   import java.io.Serializable;
   
  -public class DBKey implements Serializable
  +public class DBKey implements Serializable //TODO does it need to be serializable?
   {
       private final String driver;
       private final String url;
  @@ -57,7 +57,11 @@
           this.url = url;
           this.username = username;
           this.password = password;
  +        
  +        // All the fields used by the hashCode are now fixed, so calculate it
  +        hashCode = calculateHashCode();
       }
  +    
       // Dummy constructor to allow JMeter test suite to work
       public DBKey(){
       	this("","","","");
  @@ -147,10 +151,7 @@
   
       public int hashCode()
       {
  -        if (hashCode == 0)
  -        {
  -            hashCode = calculateHashCode();
  -        }
  +        hashCode = calculateHashCode();
           return hashCode;
       }
       
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org