Skip to content

Commit fa6cfd9

Browse files
kamacilewismc
authored andcommitted
SDAP-198 InterruptedExceptions are handled. (#46)
1 parent 32f7923 commit fa6cfd9

File tree

6 files changed

+21
-0
lines changed

6 files changed

+21
-0
lines changed

core/src/main/java/org/apache/sdap/mudrod/driver/ESDriver.java

+3
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,9 @@ public List<String> getTypeListWithPrefix(Object object, Object object2) {
244244
}
245245
} catch (InterruptedException | ExecutionException e) {
246246
LOG.error("Error whilst obtaining type list from Elasticsearch mappings.", e);
247+
if (e instanceof InterruptedException) {
248+
Thread.currentThread().interrupt();
249+
}
247250
}
248251
return typeList;
249252
}

core/src/main/java/org/apache/sdap/mudrod/integration/LinkageIntegration.java

+3
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ public Map<String, Double> appyMajorRule(String input) {
106106
map = aggregateRelatedTermsFromAllmodel(es.customAnalyzing(props.getProperty(INDEX_NAME), input));
107107
} catch (InterruptedException | ExecutionException e) {
108108
LOG.error("Error applying majority rule", e);
109+
if (e instanceof InterruptedException) {
110+
Thread.currentThread().interrupt();
111+
}
109112
}
110113

111114
for (Entry<String, List<LinkedTerm>> entry : map.entrySet()) {

core/src/main/java/org/apache/sdap/mudrod/tools/EONETIngester.java

+3
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,9 @@ private String executeBulkIndexRequest(MudrodEngine mEngine, ESDriver esDriver,
134134
updateResponse = esDriver.getClient().update(updateRequest).get();
135135
} catch (InterruptedException | ExecutionException e) {
136136
LOG.error("Failed to execute bulk Index request : ", e);
137+
if (e instanceof InterruptedException) {
138+
Thread.currentThread().interrupt();
139+
}
137140
}
138141
if (updateResponse != null) {
139142
result = updateResponse.getGetResult();

core/src/main/java/org/apache/sdap/mudrod/weblog/pre/CrawlerDetection.java

+3
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ public Object execute() {
8686
checkByRateInParallel();
8787
} catch (InterruptedException | IOException e) {
8888
LOG.error("Encountered an error whilst detecting Web crawlers.", e);
89+
if (e instanceof InterruptedException) {
90+
Thread.currentThread().interrupt();
91+
}
8992
}
9093
endTime = System.currentTimeMillis();
9194
es.refreshIndex();

core/src/main/java/org/apache/sdap/mudrod/weblog/structure/session/SessionTree.java

+6
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,9 @@ public List<ClickStream> getClickStreamList(Properties props) {
210210
viewquery = es.customAnalyzing(props.getProperty(MudrodConstants.ES_INDEX_NAME), infoStr);
211211
} catch (UnsupportedEncodingException | InterruptedException | ExecutionException e) {
212212
LOG.warn("Exception getting search info. Ignoring...", e);
213+
if (e instanceof InterruptedException) {
214+
Thread.currentThread().interrupt();
215+
}
213216
}
214217

215218
String dataset = viewnode.getDatasetId();
@@ -492,6 +495,9 @@ public List<RankingTrainData> getRankingTrainData(String indexName) throws Unsup
492495
try {
493496
query = es.customAnalyzing(props.getProperty(MudrodConstants.ES_INDEX_NAME), infoStr);
494497
} catch (InterruptedException | ExecutionException e) {
498+
if (e instanceof InterruptedException) {
499+
Thread.currentThread().interrupt();
500+
}
495501
throw new RuntimeException("Error performing custom analyzing", e);
496502
}
497503
Map<String, String> filter = RequestUrl.getFilterInfo(queryUrl);

service/src/main/java/org/apache/sdap/mudrod/services/search/SearchDatasetDetailResource.java

+3
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ public Response searchDatasetDetail(@QueryParam("shortname") String shortName) {
6868
dataDetailJson = mEngine.getESDriver().searchByQuery(config.getProperty(MudrodConstants.ES_INDEX_NAME), config.getProperty(MudrodConstants.RAW_METADATA_TYPE), query, true);
6969
} catch (InterruptedException | ExecutionException | IOException e) {
7070
LOG.error("Error whilst searching for a Dataset-ShortName: ", e);
71+
if (e instanceof InterruptedException) {
72+
Thread.currentThread().interrupt();
73+
}
7174
}
7275
LOG.info("Response received: {}", dataDetailJson);
7376
return Response.ok(dataDetailJson, MediaType.APPLICATION_JSON).build();

0 commit comments

Comments
 (0)