Do not guard simple logging with isXXXEnabled() 18/36118/1
authorRobert Varga <rovarga@cisco.com>
Fri, 11 Mar 2016 12:30:52 +0000 (13:30 +0100)
committerRobert Varga <rovarga@cisco.com>
Fri, 11 Mar 2016 12:32:00 +0000 (13:32 +0100)
There is not benefit in the guards, making them pure overhead.

Change-Id: I75e310a2f08e5650db436bb4a7f46d85cbde313d
Signed-off-by: Robert Varga <rovarga@cisco.com>
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/common/actor/AbstractUntypedPersistentActor.java

index 326733f..a48e8cd 100644 (file)
@@ -16,40 +16,27 @@ public abstract class AbstractUntypedPersistentActor extends UntypedPersistentAc
 
     protected final Logger LOG = LoggerFactory.getLogger(getClass());
 
-    public AbstractUntypedPersistentActor() {
-        if(LOG.isTraceEnabled()) {
-            LOG.trace("Actor created {}", getSelf());
-        }
-        getContext().
-            system().
-            actorSelection("user/termination-monitor").
-            tell(new Monitor(getSelf()), getSelf());
-
+    protected AbstractUntypedPersistentActor() {
+        LOG.trace("Actor created {}", getSelf());
+        getContext().system().actorSelection("user/termination-monitor").tell(new Monitor(getSelf()), getSelf());
     }
 
-
-    @Override public void onReceiveCommand(Object message) throws Exception {
+    @Override
+    public void onReceiveCommand(Object message) throws Exception {
         final String messageType = message.getClass().getSimpleName();
-        if(LOG.isTraceEnabled()) {
-            LOG.trace("Received message {}", messageType);
-        }
+        LOG.trace("Received message {}", messageType);
+
         handleCommand(message);
-        if(LOG.isTraceEnabled()) {
-            LOG.trace("Done handling message {}", messageType);
-        }
 
+        LOG.trace("Done handling message {}", messageType);
     }
 
-    @Override public void onReceiveRecover(Object message) throws Exception {
+    @Override
+    public void onReceiveRecover(Object message) throws Exception {
         final String messageType = message.getClass().getSimpleName();
-        if(LOG.isTraceEnabled()) {
-            LOG.trace("Received message {}", messageType);
-        }
+        LOG.trace("Received message {}", messageType);
         handleRecover(message);
-        if(LOG.isTraceEnabled()) {
-            LOG.trace("Done handling message {}", messageType);
-        }
-
+        LOG.trace("Done handling message {}", messageType);
     }
 
     protected abstract void handleRecover(Object message) throws Exception;
@@ -61,9 +48,7 @@ public abstract class AbstractUntypedPersistentActor extends UntypedPersistentAc
     }
 
     protected void unknownMessage(Object message) throws Exception {
-        if(LOG.isDebugEnabled()) {
-            LOG.debug("Received unhandled message {}", message);
-        }
+        LOG.debug("Received unhandled message {}", message);
         unhandled(message);
     }
 }