import java.util.Collection;
+import javax.annotation.Nonnull;
+
import org.opendaylight.controller.md.sal.binding.api.ClusteredDataTreeChangeListener;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.DataObjectModification;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.MoreExecutors;
public class ActionDefinitionListener implements ClusteredDataTreeChangeListener<ActionDefinition>, AutoCloseable {
.child(Renderer.class, new RendererKey(OFOverlayRenderer.RENDERER_NAME))
.child(Capabilities.class)
.build();
- private static String PUT = "stored";
- private static String DELETED = "removed";
+ private static final String PUT = "stored";
+ private static final String DELETED = "removed";
private final DataBroker dataProvider;
private final ListenerRegistration<ActionDefinitionListener> registration;
}
@Override
- public void onDataTreeChanged(Collection<DataTreeModification<ActionDefinition>> changes) {
+ public void onDataTreeChanged(@Nonnull Collection<DataTreeModification<ActionDefinition>> changes) {
for (DataTreeModification<ActionDefinition> change : changes) {
DataObjectModification<ActionDefinition> rootNode = change.getRootNode();
wTx.put(LogicalDatastoreType.OPERATIONAL, CAPABILITIES_IID
.child(SupportedActionDefinition.class, supportedActionDefinition.getKey()),
supportedActionDefinition, true);
- Futures.addCallback(wTx.submit(), logDebugResult(supportedActionDefinition.getKey(), PUT));
+ Futures.addCallback(wTx.submit(), logDebugResult(supportedActionDefinition.getKey(), PUT), MoreExecutors
+ .directExecutor());
}
break;
WriteTransaction wTx = dataProvider.newWriteOnlyTransaction();
wTx.delete(LogicalDatastoreType.OPERATIONAL,
CAPABILITIES_IID.child(SupportedActionDefinition.class, supportedActionDefinitionKey));
- Futures.addCallback(wTx.submit(), logDebugResult(supportedActionDefinitionKey, DELETED));
+ Futures.addCallback(wTx.submit(), logDebugResult(supportedActionDefinitionKey, DELETED), MoreExecutors.directExecutor());
}
break;
}
}
@Override
- public void onFailure(Throwable t) {
+ public void onFailure(@Nonnull Throwable t) {
LOG.error("Capability of renderer {} was NOT {}: {}", OFOverlayRenderer.RENDERER_NAME.getValue(),
putOrDeleted, supportedActionDefinitionKey, t);
}