livy-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vanzin <...@git.apache.org>
Subject [GitHub] incubator-livy pull request #128: [LIVY-533] Use setJobGroup/cancelJobGroup ...
Date Fri, 30 Nov 2018 18:25:13 GMT
Github user vanzin commented on a diff in the pull request:

    https://github.com/apache/incubator-livy/pull/128#discussion_r237956271
  
    --- Diff: rsc/src/main/java/org/apache/livy/rsc/driver/JobWrapper.java ---
    @@ -38,21 +34,31 @@
       public final String jobId;
     
       private final RSCDriver driver;
    +
       private final Job<T> job;
    -  private final AtomicInteger completed;
    +
    +  private boolean isCancelled = false;
     
       private Future<?> future;
     
       public JobWrapper(RSCDriver driver, String jobId, Job<T> job) {
         this.driver = driver;
         this.jobId = jobId;
         this.job = job;
    -    this.completed = new AtomicInteger();
       }
     
       @Override
       public Void call() throws Exception {
         try {
    +      // this is synchronized to avoid races with cancel()
    +      synchronized (this) {
    +        if (isCancelled) {
    +          throw new Exception("Job isCancelled");
    --- End diff --
    
    Throw `CancellationException` instead.


---

Mime
View raw message