[ 
https://issues.apache.org/jira/browse/GOBBLIN-1068?focusedWorklogId=397970&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-397970
 ]

ASF GitHub Bot logged work on GOBBLIN-1068:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 04/Mar/20 23:31
            Start Date: 04/Mar/20 23:31
    Worklog Time Spent: 10m 
      Work Description: sv2000 commented on pull request #2907: 
[GOBBLIN-1068]Clean up cyclic logic in task cancellation
URL: https://github.com/apache/incubator-gobblin/pull/2907#discussion_r387985305
 
 

 ##########
 File path: 
gobblin-cluster/src/main/java/org/apache/gobblin/cluster/SleepingTask.java
 ##########
 @@ -19,27 +19,37 @@
 
 import java.io.File;
 import java.io.IOException;
+import java.util.concurrent.TimeoutException;
 
+import org.apache.gobblin.runtime.TaskContext;
+import org.apache.gobblin.runtime.TaskState;
+import org.apache.gobblin.runtime.task.BaseAbstractTask;
+import org.apache.gobblin.testing.AssertWithBackoff;
+
+import com.google.common.base.Predicate;
 import com.google.common.base.Throwables;
 import com.google.common.io.Files;
 
+import javax.annotation.Nullable;
 import lombok.extern.slf4j.Slf4j;
 
-import org.apache.gobblin.runtime.TaskContext;
-import org.apache.gobblin.runtime.TaskState;
-import org.apache.gobblin.runtime.task.BaseAbstractTask;
 
 @Slf4j
 public class SleepingTask extends BaseAbstractTask {
   public static final String TASK_STATE_FILE_KEY = "task.state.file.path";
+  public static final String SLEEPING_TASK_SLEEP_TIME = 
"data.publisher.sleep.time.in.seconds";
 
   private final long sleepTime;
   private File taskStateFile;
+  // If sleepTime is configured to be a negative value, it indicates user 
wants to put it in long sleep until
+  // external interruption.
+  private boolean infiniteSleep;
 
   public SleepingTask(TaskContext taskContext) {
     super(taskContext);
     TaskState taskState = taskContext.getTaskState();
-    sleepTime = 
taskState.getPropAsLong("data.publisher.sleep.time.in.seconds", 10L);
+    sleepTime = taskState.getPropAsLong(SLEEPING_TASK_SLEEP_TIME, 10L);
+    infiniteSleep = sleepTime < 0;
 
 Review comment:
   infiniteSleep -> isInfiniteSleep?
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 397970)
    Time Spent: 50m  (was: 40m)

> Clean cyclic logic in task cancellation in Gobblin Task
> -------------------------------------------------------
>
>                 Key: GOBBLIN-1068
>                 URL: https://issues.apache.org/jira/browse/GOBBLIN-1068
>             Project: Apache Gobblin
>          Issue Type: Bug
>            Reporter: Lei Sun
>            Priority: Major
>          Time Spent: 50m
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to