cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r809001 - /incubator/cassandra/trunk/src/java/org/apache/cassandra/locator/TokenMetadata.java
Date Fri, 28 Aug 2009 19:33:05 GMT
Author: jbellis
Date: Fri Aug 28 19:33:05 2009
New Revision: 809001

URL: http://svn.apache.org/viewvc?rev=809001&view=rev
Log:
move Map creation into default constructor so we don't waste object creation when the non-default
constructor is used
patch by jbellis

Modified:
    incubator/cassandra/trunk/src/java/org/apache/cassandra/locator/TokenMetadata.java

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/locator/TokenMetadata.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/locator/TokenMetadata.java?rev=809001&r1=809000&r2=809001&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/locator/TokenMetadata.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/locator/TokenMetadata.java Fri
Aug 28 19:33:05 2009
@@ -28,24 +28,27 @@
 public class TokenMetadata
 {
     /* Maintains token to endpoint map of every node in the cluster. */
-    private Map<Token, EndPoint> tokenToEndPointMap_ = new HashMap<Token, EndPoint>();
+    private Map<Token, EndPoint> tokenToEndPointMap_;
     /* Maintains a reverse index of endpoint to token in the cluster. */
-    private Map<EndPoint, Token> endPointToTokenMap_ = new HashMap<EndPoint, Token>();
+    private Map<EndPoint, Token> endPointToTokenMap_;
     /* Bootstrapping nodes and their tokens */
-    private Map<Token, EndPoint> bootstrapNodes = Collections.synchronizedMap(new HashMap<Token,
EndPoint>());
+    private Map<Token, EndPoint> bootstrapNodes;
     
     /* Use this lock for manipulating the token map */
     private final ReadWriteLock lock_ = new ReentrantReadWriteLock(true);
 
     public TokenMetadata()
     {
+        tokenToEndPointMap_ = new HashMap<Token, EndPoint>();
+        endPointToTokenMap_ = new HashMap<EndPoint, Token>();
+        this.bootstrapNodes = Collections.synchronizedMap(new HashMap<Token, EndPoint>());
     }
 
     public TokenMetadata(Map<Token, EndPoint> tokenToEndPointMap, Map<EndPoint,
Token> endPointToTokenMap, Map<Token, EndPoint> bootstrapNodes)
     {
         tokenToEndPointMap_ = tokenToEndPointMap;
         endPointToTokenMap_ = endPointToTokenMap;
-        this.bootstrapNodes = bootstrapNodes; 
+        this.bootstrapNodes = bootstrapNodes;
     }
     
     public TokenMetadata cloneMe()



Mime
View raw message