You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iota.apache.org by to...@apache.org on 2016/11/29 23:29:13 UTC
[14/31] incubator-iota git commit: Removed scalastyle in
FeyGenericActor
Removed scalastyle in FeyGenericActor
Project: http://git-wip-us.apache.org/repos/asf/incubator-iota/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-iota/commit/6f4e0bee
Tree: http://git-wip-us.apache.org/repos/asf/incubator-iota/tree/6f4e0bee
Diff: http://git-wip-us.apache.org/repos/asf/incubator-iota/diff/6f4e0bee
Branch: refs/heads/master
Commit: 6f4e0beeaed4d41993a8f1a8a97ee72547621b94
Parents: a0bca13
Author: Shivansh <sh...@gmail.com>
Authored: Fri Nov 4 00:24:19 2016 +0530
Committer: Shivansh <sh...@gmail.com>
Committed: Fri Nov 4 00:24:19 2016 +0530
----------------------------------------------------------------------
.../org/apache/iota/fey/FeyGenericActor.scala | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-iota/blob/6f4e0bee/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 36f39fa..dd83ce1 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
@@ -1,4 +1,3 @@
-
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -45,12 +44,14 @@ abstract class FeyGenericActor(val params: Map[String,String] = Map.empty,
extends Actor with ActorLogging{
+ val DEFAULT_NULL = null
+
import FeyGenericActor._
/**
* Keeps reference to the cancellable
*/
- @volatile private var scheduler: Cancellable = null
+ @volatile private var scheduler: Cancellable = DEFAULT_NULL
@volatile private var endBackoff: Long = 0
private[fey] val monitoring_actor = FEY_MONITOR.actorRef
@@ -111,9 +112,9 @@ abstract class FeyGenericActor(val params: Map[String,String] = Map.empty,
* Stops the scheduler
*/
private final def stopScheduler() = {
- if (scheduler != null) {
+ if (Option(scheduler).isDefined) {
scheduler.cancel()
- scheduler = null
+ scheduler = DEFAULT_NULL
}
}
/**
@@ -129,7 +130,7 @@ 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(scheduler == null && schedulerTimeInterval.toNanos != 0){
+ if(Option(scheduler).isEmpty && schedulerTimeInterval.toNanos != 0){
scheduler = context.system.scheduler.schedule(1.seconds, schedulerTimeInterval){
try{
execute()
@@ -142,10 +143,11 @@ abstract class FeyGenericActor(val params: Map[String,String] = Map.empty,
/**
* Check state of scheduler
+ *
* @return true if scheduller is running
*/
final def isShedulerRunning():Boolean = {
- if(scheduler != null && !scheduler.isCancelled){
+ if(Option(scheduler).isDefined && !scheduler.isCancelled){
true
}else{
false
@@ -154,6 +156,7 @@ abstract class FeyGenericActor(val params: Map[String,String] = Map.empty,
/**
* get endBackoff
+ *
* @return
*/
final def getEndBackoff(): Long = {
@@ -170,6 +173,7 @@ abstract class FeyGenericActor(val params: Map[String,String] = Map.empty,
* Called every time actors receives the PROCESS message.
* The default implementation propagates the message to the connected actors
* and fires up the backoff
+ *
* @param message message to be processed
* @tparam T Any
*/
@@ -220,12 +224,14 @@ abstract class FeyGenericActor(val params: Map[String,String] = Map.empty,
/**
* Used to set a info message when sending Stop monitor events
+ *
* @return String info
*/
def stopMonitorInfo:String = "Stopped"
/**
* Used to set a info message when sending Start monitor events
+ *
* @return String info
*/
def startMonitorInfo:String = "Started"
@@ -263,3 +269,4 @@ object FeyGenericActor {
+