/*
 * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
 * and is available at http://www.eclipse.org/legal/epl-v10.html
 */

package org.opendaylight.controller.cluster.common.actor;

import akka.actor.UntypedActor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public abstract class AbstractUntypedActor extends UntypedActor {
    protected final Logger LOG = LoggerFactory.getLogger(getClass());

    public AbstractUntypedActor() {
        if(LOG.isDebugEnabled()) {
            LOG.debug("Actor created {}", getSelf());
        }
        getContext().
            system().
            actorSelection("user/termination-monitor").
            tell(new Monitor(getSelf()), getSelf());

    }

    @Override public void onReceive(Object message) throws Exception {
        final String messageType = message.getClass().getSimpleName();
        if(LOG.isDebugEnabled()) {
//            LOG.debug("Received message {}", messageType);
        }
        handleReceive(message);
        if(LOG.isDebugEnabled()) {
//            LOG.debug("Done handling message {}", messageType);
        }
    }

    protected abstract void handleReceive(Object message) throws Exception;

    protected void ignoreMessage(Object message) {
        LOG.debug("Unhandled message {} ", message);
    }

    protected void unknownMessage(Object message) throws Exception {
        if(LOG.isDebugEnabled()) {
            LOG.debug("Received unhandled message {}", message);
        }
        unhandled(message);
    }
}

@@ -593,21 +593,24 @@
 ;%0A%0A    p
-ublic
+rotected
  Abstrac
@@ -631,47 +631,8 @@
 ) %7B%0A
-        if(LOG.isDebugEnabled()) %7B%0A    
     
@@ -677,26 +677,16 @@
 elf());%0A
-        %7D%0A
         
@@ -702,43 +702,17 @@
 t().
-%0A            system().%0A            
+system().
 acto
@@ -750,29 +750,16 @@
 nitor%22).
-%0A            
 tell(new
@@ -787,25 +787,24 @@
 getSelf());%0A
-%0A
     %7D%0A%0A    @
@@ -811,16 +811,20 @@
 Override
+%0A   
  public 
@@ -885,319 +885,31 @@
     
-final String messageType = message.getClass().getSimpleName();%0A        if(LOG.isDebugEnabled()) %7B%0A//            LOG.debug(%22Received message %7B%7D%22, messageType);%0A        %7D%0A        handleReceive(message);%0A        if(LOG.isDebugEnabled()) %7B%0A//            LOG.debug(%22Done handling message %7B%7D%22, messageType);%0A        %7D
+handleReceive(message);
 %0A   
@@ -1079,17 +1079,16 @@
 ssage %7B%7D
- 
 %22, messa
@@ -1172,47 +1172,8 @@
 n %7B%0A
-        if(LOG.isDebugEnabled()) %7B%0A    
     
@@ -1233,18 +1233,8 @@
 e);%0A
-        %7D%0A
     

Remove commented-out logging