import javax.annotation.Nonnull;
import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
import org.opendaylight.openflowplugin.applications.frsync.NodeListener;
import org.opendaylight.openflowplugin.applications.frsync.util.PathUtil;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
* 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, 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);
} catch (Exception e) {
- LOG.error("error processing inventory node modification: {}", nodeId, e);
+ LOG.error("Error processing inventory node modification: {}, {}", nodeId.getValue(), e);
}
}
}
protected abstract Optional<ListenableFuture<Boolean>> processNodeModification(
- DataTreeModification<T> modification) throws ReadFailedException, InterruptedException;
+ final DataTreeModification<T> modification);
- public abstract LogicalDatastoreType dsType();
+ protected abstract LogicalDatastoreType dsType();
- static String threadName() {
- final Thread currentThread = Thread.currentThread();
- return currentThread.getName();
- }
}