lower log severity to warn where appropriate
[openflowplugin.git] / samples / learning-switch / src / main / java / org / opendaylight / openflowplugin / learningswitch / LearningSwitchManagerSimpleImpl.java
index 8615ce25057beafaeb8ed962ba5ee0c610896694..cc70b2c99f8cfa98f43fe26b3d102ff8156b2257 100644 (file)
@@ -23,17 +23,17 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * Listens to packetIn notification and 
+ * Listens to packetIn notification and
  * <ul>
  * <li>in HUB mode simply floods all switch ports (except ingress port)</li>
- * <li>in LSWITCH mode collects source MAC address of packetIn and bind it with ingress port. 
- * If target MAC address is already bound then a flow is created (for direct communication between 
+ * <li>in LSWITCH mode collects source MAC address of packetIn and bind it with ingress port.
+ * If target MAC address is already bound then a flow is created (for direct communication between
  * corresponding MACs)</li>
  * </ul>
  */
 public class LearningSwitchManagerSimpleImpl implements DataChangeListenerRegistrationHolder,
         LearningSwitchManager {
-    
+
     protected static final Logger LOG = LoggerFactory
             .getLogger(LearningSwitchManagerSimpleImpl.class);
 
@@ -44,7 +44,7 @@ public class LearningSwitchManagerSimpleImpl implements DataChangeListenerRegist
     private Registration packetInRegistration;
 
     private ListenerRegistration<DataChangeListener> dataChangeListenerRegistration;
-    
+
     /**
      * @param notificationService the notificationService to set
      */
@@ -61,7 +61,7 @@ public class LearningSwitchManagerSimpleImpl implements DataChangeListenerRegist
             PacketProcessingService packetProcessingService) {
         this.packetProcessingService = packetProcessingService;
     }
-    
+
     /**
      * @param data the data to set
      */
@@ -83,7 +83,7 @@ public class LearningSwitchManagerSimpleImpl implements DataChangeListenerRegist
         learningSwitchHandler.setDataStoreAccessor(dataStoreAccessor);
         learningSwitchHandler.setPacketProcessingService(packetProcessingService);
         packetInRegistration = notificationService.registerNotificationListener(learningSwitchHandler);
-        
+
         WakeupOnNode wakeupListener = new WakeupOnNode();
         wakeupListener.setLearningSwitchHandler(learningSwitchHandler);
         dataChangeListenerRegistration = data.registerDataChangeListener(LogicalDatastoreType.OPERATIONAL,
@@ -95,9 +95,9 @@ public class LearningSwitchManagerSimpleImpl implements DataChangeListenerRegist
                 DataBroker.DataChangeScope.SUBTREE);
         LOG.debug("start() <--");
     }
-    
+
     /**
-     * stopping learning switch 
+     * stopping learning switch
      */
     @Override
     public void stop() {
@@ -106,17 +106,19 @@ public class LearningSwitchManagerSimpleImpl implements DataChangeListenerRegist
         try {
             packetInRegistration.close();
         } catch (Exception e) {
-            LOG.error(e.getMessage(), e);
+            LOG.warn("closing packetInRegistration failed: {}", e.getMessage());
+            LOG.debug("closing packetInRegistration failed..", e);
         }
         try {
             dataChangeListenerRegistration.close();
         } catch (Exception e) {
-            LOG.error(e.getMessage(), e);
+            LOG.warn("failed to close dataChangeListenerRegistration: {}", e.getMessage());
+            LOG.debug("failed to close dataChangeListenerRegistration..", e);
         }
         LOG.debug("stop() <--");
     }
-    
-   
+
+
     @Override
     public ListenerRegistration<DataChangeListener> getDataChangeListenerRegistration() {
         return dataChangeListenerRegistration;