mirror of https://github.com/apache/lucene.git
fix a concurrency issue around writing hashmap to json
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1292064 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2e2d3dac91
commit
2a13b648fa
|
@ -85,7 +85,7 @@ public final class ZkController {
|
|||
public final static String COLLECTION_PARAM_PREFIX="collection.";
|
||||
public final static String CONFIGNAME_PROP="configName";
|
||||
|
||||
private final Map<String, CoreState> coreStates = Collections.synchronizedMap(new HashMap<String, CoreState>());
|
||||
private final Map<String, CoreState> coreStates = new HashMap<String, CoreState>();
|
||||
|
||||
private SolrZkClient zkClient;
|
||||
private ZkCmdExecutor cmdExecutor;
|
||||
|
@ -900,9 +900,10 @@ public final class ZkController {
|
|||
}
|
||||
CoreState coreState = new CoreState(coreName,
|
||||
cloudDesc.getCollectionName(), props, numShards);
|
||||
coreStates.put(shardZkNodeName, coreState);
|
||||
final String nodePath = "/node_states/" + getNodeName();
|
||||
|
||||
synchronized (coreStates) {
|
||||
coreStates.put(shardZkNodeName, coreState);
|
||||
try {
|
||||
zkClient.setData(nodePath, ZkStateReader.toJSON(coreStates.values()),
|
||||
true);
|
||||
|
@ -918,6 +919,8 @@ public final class ZkController {
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private String doGetShardIdProcess(String coreName, CloudDescriptor descriptor)
|
||||
throws InterruptedException {
|
||||
final String shardZkNodeName = getNodeName() + "_" + coreName;
|
||||
|
|
Loading…
Reference in New Issue