refactoring based on @revans2 comments

Project: http://git-wip-us.apache.org/repos/asf/storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/0e941dae
Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/0e941dae
Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/0e941dae

Branch: refs/heads/master
Commit: 0e941dae57916830883d21a1ca7ed38a7ec67874
Parents: 2d06efe
Author: Boyang Jerry Peng <[email protected]>
Authored: Tue Feb 16 12:19:18 2016 -0600
Committer: Boyang Jerry Peng <[email protected]>
Committed: Thu Feb 18 10:37:29 2016 -0600

----------------------------------------------------------------------
 storm-core/src/jvm/org/apache/storm/StormTimer.java | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/storm/blob/0e941dae/storm-core/src/jvm/org/apache/storm/StormTimer.java
----------------------------------------------------------------------
diff --git a/storm-core/src/jvm/org/apache/storm/StormTimer.java 
b/storm-core/src/jvm/org/apache/storm/StormTimer.java
index a2d0145..1c0d967 100644
--- a/storm-core/src/jvm/org/apache/storm/StormTimer.java
+++ b/storm-core/src/jvm/org/apache/storm/StormTimer.java
@@ -125,7 +125,7 @@ public class StormTimer implements AutoCloseable{
     }
 
     //task to run
-    StormTimerTask task = new StormTimerTask();
+    private StormTimerTask task = new StormTimerTask();
 
     /**
      * Makes a Timer in the form of a StormTimerTask Object
@@ -158,9 +158,6 @@ public class StormTimer implements AutoCloseable{
      * @param jitterMs add jitter to the run
      */
     public void schedule(int delaySecs, Runnable func, boolean checkActive, 
int jitterMs) {
-        if (this.task == null) {
-            throw new RuntimeException("task is null!");
-        }
         if (func == null) {
             throw new RuntimeException("function to schedule is null!");
         }
@@ -217,7 +214,7 @@ public class StormTimer implements AutoCloseable{
     /**
      * check if timer is active
      */
-    public void checkActive() {
+    private void checkActive() {
         if (!this.task.isActive()) {
             throw new IllegalStateException("Timer is not active");
         }
@@ -238,9 +235,6 @@ public class StormTimer implements AutoCloseable{
      * is timer waiting. Used in timer simulation
      */
     public boolean isTimerWaiting() {
-        if (task == null) {
-            throw new RuntimeException("task is null!");
-        }
         return Time.isThreadWaiting(task);
     }
 }

Reply via email to