[java] Re-interrupting the thread after handling InterruptedException
@@ -97,6 +97,9 @@ public HttpResponse execute(HttpRequest req) {
try {
status = EXECUTOR_SERVICE.submit(new TracedCallable<>(tracer, span, distributor::getStatus)).get(2, SECONDS);
} catch (ExecutionException | InterruptedException | TimeoutException e) {
+ if (e instanceof InterruptedException) {
+ Thread.currentThread().interrupt();
+ }
return new HttpResponse().setContent(utf8String(json.toJson(
ImmutableMap.of("value", ImmutableMap.of(
"ready", false,
@@ -159,7 +162,10 @@ public HttpResponse execute(HttpRequest req) {
.map(summary -> {
try {
return summary.get();
- } catch (ExecutionException | InterruptedException e) {
+ } catch (ExecutionException e) {
+ throw wrap(e);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
throw wrap(e);
}
})
