Jelajahi Sumber

#2488 use local data map

Shinsuke Sugaya 4 tahun lalu
induk
melakukan
b7d56472a1

+ 5 - 3
src/main/java/org/codelibs/fess/ds/callback/FileListIndexUpdateCallbackImpl.java

@@ -130,21 +130,23 @@ public class FileListIndexUpdateCallbackImpl implements IndexUpdateCallback {
             final Deque<String> urlQueue = new LinkedList<>();
             final Deque<String> urlQueue = new LinkedList<>();
             urlQueue.offer(url);
             urlQueue.offer(url);
             while (!urlQueue.isEmpty() && (maxAccessCount < 0 || counter < maxAccessCount)) {
             while (!urlQueue.isEmpty() && (maxAccessCount < 0 || counter < maxAccessCount)) {
+                final Map<String, Object> localDataMap =
+                        dataMap.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
                 String processingUrl = urlQueue.poll();
                 String processingUrl = urlQueue.poll();
                 if (deleteUrlList.contains(processingUrl)) {
                 if (deleteUrlList.contains(processingUrl)) {
                     deleteDocuments(); // delete before indexing
                     deleteDocuments(); // delete before indexing
                 }
                 }
                 try {
                 try {
                     for (int i = 0; i < maxRedirectCount; i++) {
                     for (int i = 0; i < maxRedirectCount; i++) {
-                        processingUrl = processRequest(paramMap, dataMap, processingUrl, client);
+                        processingUrl = processRequest(paramMap, localDataMap, processingUrl, client);
                         if (processingUrl == null) {
                         if (processingUrl == null) {
                             break;
                             break;
                         }
                         }
                         counter++;
                         counter++;
-                        dataMap.put(fessConfig.getIndexFieldUrl(), processingUrl);
+                        localDataMap.put(fessConfig.getIndexFieldUrl(), processingUrl);
                     }
                     }
                 } catch (ChildUrlsException e) {
                 } catch (ChildUrlsException e) {
-                    e.getChildUrlList().stream().map(req -> req.getUrl()).forEach(urlQueue::offer);
+                    e.getChildUrlList().stream().map(RequestData::getUrl).forEach(urlQueue::offer);
                 } catch (DataStoreCrawlingException e) {
                 } catch (DataStoreCrawlingException e) {
                     Throwable cause = e.getCause();
                     Throwable cause = e.getCause();
                     if (cause instanceof ChildUrlsException) {
                     if (cause instanceof ChildUrlsException) {