Github user knusbaum commented on a diff in the pull request:
https://github.com/apache/storm/pull/1053#discussion_r52079277
--- Diff: storm-core/src/jvm/org/apache/storm/utils/Utils.java ---
@@ -1367,12 +1367,67 @@ public static int toPositive(int number) {
return number & Integer.MAX_VALUE;
}
- public static RuntimeException wrapInRuntime(Exception e){
- if (e instanceof RuntimeException){
- return (RuntimeException)e;
- }else {
+ public static RuntimeException wrapInRuntime(Exception e) {
+ if (e instanceof RuntimeException) {
+ return (RuntimeException) e;
+ } else {
return new RuntimeException(e);
}
}
+
+ public static void ensure_process_killed(Integer pid) {
+ // in this function, just kill the process 5 times
+ // make sure the process be killed definitely
+ for (int i = 0; i < 5; i++) {
+ try {
+ exec_command("kill -9 " + pid);
+ LOG.info("kill -9 process " + pid);
+ sleepMs(100);
+ } catch (ExecuteException e) {
+ LOG.info("Error when trying to kill " + pid + ". Process
has been killed");
+ return;
+ } catch (Exception e) {
+ LOG.info("Error when trying to kill " + pid + ".Exception
", e);
+ }
+ }
+ }
+
+ public static void process_killed(Integer pid) {
+ try {
+ exec_command("kill " + pid);
+ LOG.info("kill process " + pid);
+ } catch (ExecuteException e) {
+ LOG.info("Error when trying to kill " + pid + ". Process has
been killed. ");
+ } catch (Exception e) {
+ LOG.info("Error when trying to kill " + pid + ".Exception ",
e);
+ }
+ }
+
+ public static void kill(Integer pid) {
--- End diff --
We already have process killing stuff in Util.java.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---