Author: jbellis
Date: Mon Jan 31 16:02:21 2011
New Revision: 1065660

URL: http://svn.apache.org/viewvc?rev=1065660&view=rev
Log:
move initialization out of constructor where possible

Modified:
    cassandra/branches/cassandra-0.7/conf/cassandra.yaml
    
cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/locator/TokenMetadata.java

Modified: cassandra/branches/cassandra-0.7/conf/cassandra.yaml
URL: 
http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/conf/cassandra.yaml?rev=1065660&r1=1065659&r2=1065660&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/conf/cassandra.yaml (original)
+++ cassandra/branches/cassandra-0.7/conf/cassandra.yaml Mon Jan 31 16:02:21 
2011
@@ -220,7 +220,7 @@ rpc_timeout_in_ms: 10000
 # org.apache.cassandra.locator.PropertyFileSnitch:
 #  - Proximity is determined by rack and data center, which are
 #    explicitly configured in cassandra-topology.properties.
-endpoint_snitch: org.apache.cassandra.locator.SimpleSnitch
+endpoint_snitch: org.apache.cassandra.locator.PropertyFileSnitch
 
 # dynamic_snitch -- This boolean controls whether the above snitch is
 # wrapped with a dynamic snitch, which will monitor read latencies

Modified: 
cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/locator/TokenMetadata.java
URL: 
http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/locator/TokenMetadata.java?rev=1065660&r1=1065659&r2=1065660&view=diff
==============================================================================
--- 
cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/locator/TokenMetadata.java
 (original)
+++ 
cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/locator/TokenMetadata.java
 Mon Jan 31 16:02:21 2011
@@ -50,22 +50,22 @@ public class TokenMetadata
     // for any nodes that boot simultaneously between same two nodes. For this 
we cannot simply make pending ranges a <tt>Multimap</tt>,
     // since that would make us unable to notice the real problem of two nodes 
trying to boot using the same token.
     // In order to do this properly, we need to know what tokens are booting 
at any time.
-    private BiMap<Token, InetAddress> bootstrapTokens;
+    private BiMap<Token, InetAddress> bootstrapTokens = HashBiMap.create();
 
     // we will need to know at all times what nodes are leaving and calculate 
ranges accordingly.
     // An anonymous pending ranges list is not enough, as that does not tell 
which node is leaving
     // and/or if the ranges are there because of bootstrap or leave operation.
     // (See CASSANDRA-603 for more detail + examples).
-    private Set<InetAddress> leavingEndpoints;
+    private Set<InetAddress> leavingEndpoints = new HashSet<InetAddress>();
 
-    private ConcurrentMap<String, Multimap<Range, InetAddress>> pendingRanges;
+    private ConcurrentMap<String, Multimap<Range, InetAddress>> pendingRanges 
= new ConcurrentHashMap<String, Multimap<Range, InetAddress>>();
 
     /* Use this lock for manipulating the token map */
     private final ReadWriteLock lock = new ReentrantReadWriteLock(true);
     private ArrayList<Token> sortedTokens;
 
     /* list of subscribers that are notified when the tokenToEndpointMap 
changed */
-    private final CopyOnWriteArrayList<AbstractReplicationStrategy> 
subscribers;
+    private final CopyOnWriteArrayList<AbstractReplicationStrategy> 
subscribers = new CopyOnWriteArrayList<AbstractReplicationStrategy>();
 
     public TokenMetadata()
     {
@@ -77,11 +77,7 @@ public class TokenMetadata
         if (tokenToEndpointMap == null)
             tokenToEndpointMap = HashBiMap.create();
         this.tokenToEndpointMap = tokenToEndpointMap;
-        bootstrapTokens = HashBiMap.create();
-        leavingEndpoints = new HashSet<InetAddress>();
-        pendingRanges = new ConcurrentHashMap<String, Multimap<Range, 
InetAddress>>();
         sortedTokens = sortTokens();
-        subscribers = new CopyOnWriteArrayList<AbstractReplicationStrategy>();
     }
 
     private ArrayList<Token> sortTokens()


Reply via email to