You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Aleksandr Dubinsky (JIRA)" <ji...@apache.org> on 2015/10/29 22:16:27 UTC
[jira] [Created] (EXEC-96) When execution is interrupted, an
exception should be thrown or interrupted flag should be set
Aleksandr Dubinsky created EXEC-96:
--------------------------------------
Summary: When execution is interrupted, an exception should be thrown or interrupted flag should be set
Key: EXEC-96
URL: https://issues.apache.org/jira/browse/EXEC-96
Project: Commons Exec
Issue Type: Improvement
Affects Versions: 1.3
Reporter: Aleksandr Dubinsky
DefaultExecutor handles InterruptedException while waiting for the process to finish executing by killing the process and setting the error code to INVALID_EXITVALUE. This behavior isn't documented. It would be better if it threw an InterruptedExecuteException or an InterruptedIOException. This would clearly communicate the reason that execution failed. Also, it should throw this exception even if exitValues is null.
In Java 8 there is a new method Process.destroyForcibly. I haven't used it, but I wonder if it may be appropriate to call it instead of destroy.
I tried to understand how thread interruption would affect the other operations in executeInternal, particularly streams.stop. I'm not sure if that works correctly. It seems to swallow the InterruptedException, but I don't know how likely it is to block for any length of time. Nevertheless, if it's not going to re-throw the InterruptedException, it should set the interrupted flag.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)