Revision 61258
Added by Alessia Bardi almost 3 years ago
modules/dnet-openaireplus-workflows/trunk/src/main/java/eu/dnetlib/msro/openaireplus/workflows/nodes/index/FeedMissingClaimsJobNode.java | ||
---|---|---|
65 | 65 |
log.info("Starting to feed claims in index collection "+coll); |
66 | 66 |
int count = 0; |
67 | 67 |
for (String record : queue) { |
68 |
final String id = reader.read(new StringReader(record)).valueOf("//*[local-name() = 'objIdentifier']"); |
|
69 |
count++; |
|
70 |
if(log.isDebugEnabled()){ |
|
71 |
log.debug("Processing record "+count); |
|
68 |
try { |
|
69 |
final String id = reader.read(new StringReader(record)).valueOf("//*[local-name() = 'objIdentifier']"); |
|
70 |
count++; |
|
71 |
if (log.isDebugEnabled()) { |
|
72 |
log.debug("Processing record " + count); |
|
73 |
} |
|
74 |
if (idxClient.isRecordIndexed(id)) { |
|
75 |
toDeleteFromCache.add(id); |
|
76 |
} else { |
|
77 |
toFeed.add(idxClient.prepareSolrDocument(record, indexDsId, xslt)); |
|
78 |
} |
|
79 |
if (count % BATCH_SIZE == 0) processLists(idxClient, toFeed, toDeleteFromCache); |
|
80 |
}catch(CloudIndexClientException cie){ |
|
81 |
log.error("Error feeding missing claims", cie); |
|
82 |
if (idxClient != null) { |
|
83 |
idxClient.close(); |
|
84 |
} |
|
85 |
idxClient = CloudIndexClientFactory.newIndexClient(baseUrl, coll, false); |
|
86 |
log.info("Got new CloudIndexClient"); |
|
72 | 87 |
} |
73 |
if (idxClient.isRecordIndexed(id)) { |
|
74 |
toDeleteFromCache.add(id); |
|
75 |
} else { |
|
76 |
toFeed.add(idxClient.prepareSolrDocument(record, indexDsId, xslt)); |
|
77 |
} |
|
78 |
if(count % BATCH_SIZE == 0) processLists(idxClient, toFeed, toDeleteFromCache); |
|
79 |
|
|
80 | 88 |
} |
81 | 89 |
if(!toFeed.isEmpty() || !toDeleteFromCache.isEmpty()) processLists(idxClient, toFeed, toDeleteFromCache); |
82 | 90 |
log.info(String.format("Finished feeding of claims in index collection %s, total: %d", coll, count)); |
83 | 91 |
|
84 |
} catch (Throwable e) {
|
|
92 |
} catch(Throwable e) { |
|
85 | 93 |
log.error("Error feeding missing claims", e); |
86 | 94 |
throw new MSROException("Error feeding missing claims: " + e.getMessage(), e); |
87 | 95 |
} finally { |
Also available in: Unified diff
catching CloudIndexClientException trying to avoid the problem with org.apache.zookeeper.KeeperException$SessionExpiredException: KeeperErrorCode = Session expired for /collections/TMF-index-openaire/state.json