added other check on es return code
This commit is contained in:
parent
173b0c289e
commit
5eaa655f01
|
@ -125,6 +125,7 @@ public class BulkUpload {
|
||||||
request.add(new IndexRequest(elasticSearchIndexName).id(idES)
|
request.add(new IndexRequest(elasticSearchIndexName).id(idES)
|
||||||
.source(ace.toJson(),XContentType.JSON));
|
.source(ace.toJson(),XContentType.JSON));
|
||||||
|
|
||||||
|
log.info("Indexing: "+idES+" :: "+ace.toJson());
|
||||||
BulkResponse bulkResponse = client.bulk(request, RequestOptions.DEFAULT);
|
BulkResponse bulkResponse = client.bulk(request, RequestOptions.DEFAULT);
|
||||||
if (bulkResponse!=null) {
|
if (bulkResponse!=null) {
|
||||||
esResponseCode = bulkResponse.status().getStatus();
|
esResponseCode = bulkResponse.status().getStatus();
|
||||||
|
@ -133,6 +134,9 @@ public class BulkUpload {
|
||||||
log.error("FailureMessage: " + bulkResponse.buildFailureMessage());
|
log.error("FailureMessage: " + bulkResponse.buildFailureMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
esResponseCode = -3;
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Indexing "+e.getMessage());
|
log.error("Indexing "+e.getMessage());
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -63,6 +63,7 @@ public class RunSPARQLQueryService {
|
||||||
if (queryTemplate==null)
|
if (queryTemplate==null)
|
||||||
return null;
|
return null;
|
||||||
final String selectQueryTemplate = queryTemplate.replaceAll("%datasource", datasource).replaceAll("%collectionId", collectionId);
|
final String selectQueryTemplate = queryTemplate.replaceAll("%datasource", datasource).replaceAll("%collectionId", collectionId);
|
||||||
|
log.info("Start indexing "+ recordIds.size()+ " records ...");
|
||||||
recordIds.forEach(recordId -> {
|
recordIds.forEach(recordId -> {
|
||||||
int operationResult = executeQueryGraph(selectQueryTemplate, recordId, isCollection);
|
int operationResult = executeQueryGraph(selectQueryTemplate, recordId, isCollection);
|
||||||
log.info("Indexing final code: "+Integer.toString(operationResult));
|
log.info("Indexing final code: "+Integer.toString(operationResult));
|
||||||
|
@ -71,9 +72,9 @@ public class RunSPARQLQueryService {
|
||||||
}
|
}
|
||||||
|
|
||||||
private int executeQueryGraph(String selectQueryTemplate, String recordId, boolean isCollection){
|
private int executeQueryGraph(String selectQueryTemplate, String recordId, boolean isCollection){
|
||||||
// to avoid heap overload on graphdb
|
// decrease queries execution rate to avoid heap overload on graphdb
|
||||||
try {
|
try {
|
||||||
Thread.sleep(100);
|
Thread.sleep(50);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue