accumulo-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] keith-turner commented on a change in pull request #402: ACCUMULO-4615: Updated get status for thread safety and with a per-task timeout
Date Thu, 22 Mar 2018 15:39:55 GMT
keith-turner commented on a change in pull request #402: ACCUMULO-4615: Updated get status
for thread safety and with a per-task timeout
URL: https://github.com/apache/accumulo/pull/402#discussion_r176468279
 
 

 ##########
 File path: server/master/src/main/java/org/apache/accumulo/master/TimeoutTaskExecutor.java
 ##########
 @@ -152,15 +172,24 @@ public void close() {
   }
 
   /*
-   * A wrapper for keeping a callable and its future together.
+   * A wrapper for a Callable that keeps additional information. This tracks if the callable
has been started, has completed (either finished or cancelled), and
+   * keeps the associated future.
    */
-  private class WrappedTask {
+  private class WrappedTask implements Callable<T> {
     public final C callable;
-    public final Future<T> future;
 
-    public WrappedTask(C callable, Future<T> future) {
+    public volatile boolean hasStarted = false;
+    public boolean hasCompleted = false;
+    public Future<T> future;
+
+    public WrappedTask(C callable) {
       this.callable = callable;
-      this.future = future;
+    }
+
+    @Override
+    public T call() throws Exception {
+      hasStarted = true;
 
 Review comment:
   What do you think about recording the time here instead of having a boolean?  Then that
could be used to determine how long to wait for the task.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message