mirror of https://github.com/apache/cassandra
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:
parent
59f87afa7a
commit
d3329d28a1
|
|
@ -220,7 +220,7 @@ rpc_timeout_in_ms: 10000
|
||||||
# org.apache.cassandra.locator.PropertyFileSnitch:
|
# org.apache.cassandra.locator.PropertyFileSnitch:
|
||||||
# - Proximity is determined by rack and data center, which are
|
# - Proximity is determined by rack and data center, which are
|
||||||
# explicitly configured in cassandra-topology.properties.
|
# 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
|
# dynamic_snitch -- This boolean controls whether the above snitch is
|
||||||
# wrapped with a dynamic snitch, which will monitor read latencies
|
# wrapped with a dynamic snitch, which will monitor read latencies
|
||||||
|
|
|
||||||
|
|
@ -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>,
|
// 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.
|
// 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.
|
// 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.
|
// 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
|
// 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.
|
// and/or if the ranges are there because of bootstrap or leave operation.
|
||||||
// (See CASSANDRA-603 for more detail + examples).
|
// (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 */
|
/* Use this lock for manipulating the token map */
|
||||||
private final ReadWriteLock lock = new ReentrantReadWriteLock(true);
|
private final ReadWriteLock lock = new ReentrantReadWriteLock(true);
|
||||||
private ArrayList<Token> sortedTokens;
|
private ArrayList<Token> sortedTokens;
|
||||||
|
|
||||||
/* list of subscribers that are notified when the tokenToEndpointMap changed */
|
/* 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()
|
public TokenMetadata()
|
||||||
{
|
{
|
||||||
|
|
@ -77,11 +77,7 @@ public class TokenMetadata
|
||||||
if (tokenToEndpointMap == null)
|
if (tokenToEndpointMap == null)
|
||||||
tokenToEndpointMap = HashBiMap.create();
|
tokenToEndpointMap = HashBiMap.create();
|
||||||
this.tokenToEndpointMap = tokenToEndpointMap;
|
this.tokenToEndpointMap = tokenToEndpointMap;
|
||||||
bootstrapTokens = HashBiMap.create();
|
|
||||||
leavingEndpoints = new HashSet<InetAddress>();
|
|
||||||
pendingRanges = new ConcurrentHashMap<String, Multimap<Range, InetAddress>>();
|
|
||||||
sortedTokens = sortTokens();
|
sortedTokens = sortTokens();
|
||||||
subscribers = new CopyOnWriteArrayList<AbstractReplicationStrategy>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private ArrayList<Token> sortTokens()
|
private ArrayList<Token> sortTokens()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue