move initialization out of constructor where possible

git-svn-id: https://svn.apache.org/repos/asf/cassandra/branches/cassandra-0.7@1065660 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jonathan Ellis 2011-01-31 16:02:21 +00:00
parent 59f87afa7a
commit d3329d28a1
2 changed files with 5 additions and 9 deletions

View File

@ -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

View File

@ -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()