From: Robert Varga Date: Fri, 11 Mar 2016 12:30:52 +0000 (+0100) Subject: Do not guard simple logging with isXXXEnabled() X-Git-Tag: release/boron~319 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=6880b6dfa565e54557351019c1d1e6e76afdda9f;hp=cc48f400825fa1ea63911feeb9f8767f6d51f16e Do not guard simple logging with isXXXEnabled() There is not benefit in the guards, making them pure overhead. Change-Id: I75e310a2f08e5650db436bb4a7f46d85cbde313d Signed-off-by: Robert Varga --- diff --git a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/common/actor/AbstractUntypedPersistentActor.java b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/common/actor/AbstractUntypedPersistentActor.java index 326733f377..a48e8cd4e3 100644 --- a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/common/actor/AbstractUntypedPersistentActor.java +++ b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/common/actor/AbstractUntypedPersistentActor.java @@ -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); } }