mirror of https://github.com/apache/lucene.git
SOLR-1146 -- ConcurrentModificationException in DataImporter.getStatusMessages
git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@771580 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4ea488c8fb
commit
6ef6e52271
|
@ -234,6 +234,9 @@ Bug Fixes
|
|||
25.SOLR-1090: DataImportHandler should load the data-config.xml using UTF-8 encoding.
|
||||
(Rui Pereira, shalin)
|
||||
|
||||
26.SOLR-1146: ConcurrentModificationException in DataImporter.getStatusMessages
|
||||
(Walter Ferrara, Noble Paul via shalin)
|
||||
|
||||
Documentation
|
||||
----------------------
|
||||
|
||||
|
|
|
@ -382,12 +382,17 @@ public class DataImporter {
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, String> getStatusMessages() {
|
||||
//this map object is a Collections.synchronizedMap(new LinkedHashMap()). if we
|
||||
// synchronize on the object it must be safe to iterate through the map
|
||||
Map statusMessages = (Map) retrieve(STATUS_MSGS);
|
||||
Map<String, String> result = new LinkedHashMap<String, String>();
|
||||
if (statusMessages != null) {
|
||||
for (Object o : statusMessages.entrySet()) {
|
||||
Map.Entry e = (Map.Entry) o;
|
||||
result.put((String) e.getKey(), e.getValue().toString());
|
||||
synchronized (statusMessages) {
|
||||
for (Object o : statusMessages.entrySet()) {
|
||||
Map.Entry e = (Map.Entry) o;
|
||||
//the toString is taken because some of the Objects create the data lazily when toString() is called
|
||||
result.put((String) e.getKey(), e.getValue().toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
|
|
@ -48,7 +48,7 @@ public class DocBuilder {
|
|||
private DataConfig.Entity root;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private Map statusMessages = new LinkedHashMap();
|
||||
private Map statusMessages = Collections.synchronizedMap(new LinkedHashMap());
|
||||
|
||||
public Statistics importStatistics = new Statistics();
|
||||
|
||||
|
|
Loading…
Reference in New Issue