iota-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tonyfaust...@apache.org
Subject [24/31] incubator-iota git commit: Corrected FeyGenericActor.scala according to the comments
Date Tue, 29 Nov 2016 23:29:23 GMT
Corrected FeyGenericActor.scala according to the comments


Project: http://git-wip-us.apache.org/repos/asf/incubator-iota/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-iota/commit/9142e653
Tree: http://git-wip-us.apache.org/repos/asf/incubator-iota/tree/9142e653
Diff: http://git-wip-us.apache.org/repos/asf/incubator-iota/diff/9142e653

Branch: refs/heads/master
Commit: 9142e65391b054561e0cfd12cb032f40dcdb49ce
Parents: a91998f
Author: Shivansh <shiv4nsh@gmail.com>
Authored: Tue Nov 15 06:31:39 2016 +0530
Committer: Shivansh <shiv4nsh@gmail.com>
Committed: Tue Nov 15 06:31:39 2016 +0530

----------------------------------------------------------------------
 .../scala/org/apache/iota/fey/FeyGenericActor.scala   | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-iota/blob/9142e653/fey-core/src/main/scala/org/apache/iota/fey/FeyGenericActor.scala
----------------------------------------------------------------------
diff --git a/fey-core/src/main/scala/org/apache/iota/fey/FeyGenericActor.scala b/fey-core/src/main/scala/org/apache/iota/fey/FeyGenericActor.scala
index 970a99f..d5be525 100644
--- a/fey-core/src/main/scala/org/apache/iota/fey/FeyGenericActor.scala
+++ b/fey-core/src/main/scala/org/apache/iota/fey/FeyGenericActor.scala
@@ -50,7 +50,7 @@ abstract class FeyGenericActor(val params: Map[String,String] = Map.empty,
   /**
     * Keeps reference to the cancellable
     */
-  @volatile private var scheduler: Cancellable = null
+  @volatile private var scheduler: Option[Cancellable] = None
   @volatile private var endBackoff: Long = 0
   private[fey] val monitoring_actor = FEY_MONITOR.actorRef
 
@@ -111,8 +111,8 @@ abstract class FeyGenericActor(val params: Map[String,String] = Map.empty,
     * Stops the scheduler
     */
   private final def stopScheduler() = {
-    if (Option(scheduler).isDefined) {
-      scheduler.cancel()
+    if (scheduler.isDefined) {
+      scheduler.get.cancel()
       scheduler = null
     }
   }
@@ -129,14 +129,14 @@ abstract class FeyGenericActor(val params: Map[String,String] = Map.empty,
     * The time interval to be used is the one passed to the constructor
     */
   private final def startScheduler() = {
-    if(Option(scheduler).isEmpty && schedulerTimeInterval.toNanos != 0){
-      scheduler = context.system.scheduler.schedule(1.seconds, schedulerTimeInterval){
+    if (scheduler.isEmpty && schedulerTimeInterval.toNanos != 0) {
+      scheduler = Option(context.system.scheduler.schedule(1.seconds, schedulerTimeInterval)
{
         try{
           execute()
         }catch{
           case e: Exception => self ! EXCEPTION(e)
         }
-      }
+      })
     }
   }
 
@@ -146,7 +146,7 @@ abstract class FeyGenericActor(val params: Map[String,String] = Map.empty,
     * @return true if scheduller is running
     */
   final def isShedulerRunning():Boolean = {
-    if(Option(scheduler).isDefined && !scheduler.isCancelled){
+    if(scheduler.isDefined && !scheduler.get.isCancelled){
       true
     }else{
       false


Mime
View raw message