Skip to content

v0.2.52..v0.2.53 changeset JobCancellationResource.java

Garret Voltz edited this page Feb 12, 2020 · 1 revision
diff --git a/hoot-services/src/main/java/hoot/services/controllers/job/JobCancellationResource.java b/hoot-services/src/main/java/hoot/services/controllers/job/JobCancellationResource.java
index b16c1a5..072a137 100644
--- a/hoot-services/src/main/java/hoot/services/controllers/job/JobCancellationResource.java
+++ b/hoot-services/src/main/java/hoot/services/controllers/job/JobCancellationResource.java
@@ -22,7 +22,7 @@
  * This will properly maintain the copyright information. DigitalGlobe
  * copyrights will be updated automatically.
  *
- * @copyright Copyright (C) 2015, 2016, 2017, 2019 DigitalGlobe (http://www.digitalglobe.com/)
+ * @copyright Copyright (C) 2015, 2016, 2017, 2019, 2020 DigitalGlobe (http://www.digitalglobe.com/)
  */
 package hoot.services.controllers.job;
 
@@ -88,8 +88,8 @@ public class JobCancellationResource {
             throw new ForbiddenException("HTTP" /* This Parameter required, but will be cleared by ExceptionFilter */);
         } else {
             try {
-                this.externalCommandInterface.terminate(jobIdToCancel);
                 this.jobStatusManager.setCancelled(jobIdToCancel, "Cancelled by user!");
+                this.externalCommandInterface.terminate(jobIdToCancel);
             } catch (Exception e) {
                 String msg = "Error cancelling job with ID = " + jobIdToCancel;
                 throw new WebApplicationException(e, Response.serverError().entity(msg).build());
@@ -116,8 +116,8 @@ public class JobCancellationResource {
             throw new ForbiddenException("HTTP" /* This Parameter required, but will be cleared by ExceptionFilter */);
         } else {
             try {
-                this.externalCommandInterface.terminate(jobId);
                 this.jobStatusManager.setCancelled(jobId, "Cancelled by user!");
+                this.externalCommandInterface.terminate(jobId);
             } catch (Exception e) {
                 String msg = "Error cancelling job with ID = " + jobId;
                 throw new WebApplicationException(e, Response.serverError().entity(msg).build());
Clone this wiki locally