You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@gobblin.apache.org by GitBox <gi...@apache.org> on 2020/04/07 07:51:04 UTC

[GitHub] [incubator-gobblin] arjun4084346 commented on a change in pull request #2923: [GOBBLIN-1083] Unit test improving & return failed when helix task cancelled

arjun4084346 commented on a change in pull request #2923: [GOBBLIN-1083] Unit test improving & return failed when helix task cancelled
URL: https://github.com/apache/incubator-gobblin/pull/2923#discussion_r404606800
 
 

 ##########
 File path: gobblin-cluster/src/main/java/org/apache/gobblin/cluster/SleepingTask.java
 ##########
 @@ -20,27 +20,30 @@
 import java.io.File;
 import java.io.IOException;
 
+import org.apache.gobblin.runtime.TaskContext;
+import org.apache.gobblin.runtime.task.BaseAbstractTask;
+
 import com.google.common.base.Throwables;
 import com.google.common.io.Files;
 
 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;
+  private final TaskContext taskContext;
 
   public SleepingTask(TaskContext taskContext) {
     super(taskContext);
-    TaskState taskState = taskContext.getTaskState();
-    sleepTime = taskState.getPropAsLong("data.publisher.sleep.time.in.seconds", 10L);
-    taskStateFile = new File(taskState.getProp(TASK_STATE_FILE_KEY));
+    this.taskContext = taskContext;
+    sleepTime = taskContext.getTaskState().getPropAsLong(SLEEPING_TASK_SLEEP_TIME, 10L);
 
 Review comment:
   why `TaskState taskState = taskContext.getTaskState();` is removed?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services