Bug 6745 Improve compression queue locking and handle InterruptedException
[openflowplugin.git] / applications / forwardingrules-sync / src / main / java / org / opendaylight / openflowplugin / applications / frsync / impl / AbstractFrmSyncListener.java
index aaf4063bd0f21a6e609d686404383a90a8a7223f..835823fba7fe5692a345cfd47076e7591c20a91f 100644 (file)
@@ -26,35 +26,34 @@ import org.slf4j.LoggerFactory;
  * Abstract Listener for node changes.
  */
 public abstract class AbstractFrmSyncListener<T extends DataObject> implements NodeListener<T> {
+
     private static final Logger LOG = LoggerFactory.getLogger(AbstractFrmSyncListener.class);
 
     @Override
     public void onDataTreeChanged(@Nonnull final Collection<DataTreeModification<T>> modifications) {
         for (DataTreeModification<T> modification : modifications) {
             final NodeId nodeId = PathUtil.digNodeId(modification.getRootPath().getRootIdentifier());
-
+            if (LOG.isTraceEnabled()) {
+                LOG.trace("DataTreeModification of {} in {} datastore", nodeId.getValue(), dsType());
+            }
             try {
                 final Optional<ListenableFuture<Boolean>> optFuture = processNodeModification(modification);
                 if (optFuture.isPresent()) {
                     final ListenableFuture<Boolean> future = optFuture.get();
-                    final Boolean ret = future.get(15000, TimeUnit.MILLISECONDS);
-                    LOG.debug("syncup ret {} {} {} thread:{}", dsType(), ret, nodeId.getValue(), threadName());
+                    future.get(15000, TimeUnit.MILLISECONDS);
+                    if (LOG.isTraceEnabled()) {
+                        LOG.trace("Syncup for {} return from {} listener", nodeId.getValue(), dsType());
+                    }
                 }
-            } catch (InterruptedException e) {
-                LOG.warn("permit for forwarding rules sync not acquired: {}", nodeId.getValue());
             } catch (Exception e) {
-                LOG.error("error processing inventory node modification: {}", nodeId.getValue(), e);
+                LOG.error("Error processing inventory node modification: {}, {}", nodeId.getValue(), e);
             }
         }
     }
 
     protected abstract Optional<ListenableFuture<Boolean>> processNodeModification(
-            DataTreeModification<T> modification) throws InterruptedException;
+            final DataTreeModification<T> modification);
 
     protected abstract LogicalDatastoreType dsType();
 
-    private static String threadName() {
-        final Thread currentThread = Thread.currentThread();
-        return currentThread.getName();
-    }
 }