Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,7 @@ public ResponseT call(RequestT request) throws UserCodeExecutionException {
try {
return future.get(timeout.getMillis(), TimeUnit.MILLISECONDS);
} catch (TimeoutException | InterruptedException e) {
future.cancel(true);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

When catching InterruptedException, the interrupted status of the thread is cleared. It is a best practice to restore the interrupted status by calling Thread.currentThread().interrupt() so that upstream callers or the thread pool runner are aware of the interruption.

Suggested change
future.cancel(true);
future.cancel(true);
if (e instanceof InterruptedException) {
Thread.currentThread().interrupt();
}

throw new UserCodeTimeoutException(e);
} catch (ExecutionException e) {
parseAndThrow(future, e);
Expand Down
Loading