livy-reviews mailing list archives

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

    https://github.com/apache/incubator-livy/pull/128#discussion_r237689008
  
    --- Diff: rsc/src/main/java/org/apache/livy/rsc/driver/JobWrapper.java ---
    @@ -39,20 +39,27 @@
     
       private final RSCDriver driver;
       private final Job<T> job;
    -  private final AtomicInteger completed;
     
    -  private Future<?> future;
    +  private volatile 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()
    --- End diff --
    
    Good point. I just checked in `RSCDriver.handle(ChannelHandlerContext, BypassJobRequest)`
and it looks like this can actually happen. If it does, cancellation won't work properly (as
you said).
    
    I updated the PR with a boolean flag `isCancelled` that addresses the issue.


---

Mime
View raw message