import java.util.concurrent.Callable;
import java.util.concurrent.atomic.AtomicLong;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.NotificationService;
import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
import org.opendaylight.openflowplugin.common.wait.SimpleTaskRetryLooper;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.binding.NotificationListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
}
};
- private NotificationProviderService notificationService;
+ private NotificationService notificationService;
- private ListenerRegistration<NotificationListener> notificationRegistration;
+ private ListenerRegistration<DropTestCommiter> notificationRegistration;
/**
* start listening on packetIn
*/
public void start() {
- SimpleTaskRetryLooper looper = new SimpleTaskRetryLooper(STARTUP_LOOP_TICK,
+ final SimpleTaskRetryLooper looper = new SimpleTaskRetryLooper(STARTUP_LOOP_TICK,
STARTUP_LOOP_MAX_RETRIES);
try {
- notificationRegistration = looper.loopUntilNoException(new Callable<ListenerRegistration<NotificationListener>>() {
+ notificationRegistration = looper.loopUntilNoException(new Callable<ListenerRegistration<DropTestCommiter>>() {
@Override
- public ListenerRegistration<NotificationListener> call() throws Exception {
+ public ListenerRegistration<DropTestCommiter> call() throws Exception {
return notificationService.registerNotificationListener(DropTestCommiter.this);
}
});
- } catch (Exception e) {
+ } catch (final Exception e) {
LOG.warn("DropTest committer notification listener registration fail!");
LOG.debug("DropTest committer notification listener registration fail! ..", e);
throw new IllegalStateException("DropTest startup fail! Try again later.", e);
/**
* @param dataService the dataService to set
*/
- public void setDataService(DataBroker dataService) {
+ public void setDataService(final DataBroker dataService) {
this.dataService = dataService;
}
final FlowBuilder fb = BUILDER.get();
fb.setMatch(match);
fb.setInstructions(instructions);
- fb.setId(new FlowId(String.valueOf(fb.hashCode()) +"."+ ID_COUNTER.getAndIncrement()));
+ fb.setId(new FlowId(String.valueOf(fb.hashCode()) + "." + ID_COUNTER.getAndIncrement()));
// Construct the flow instance id
final InstanceIdentifier<Flow> flowInstanceId =
InstanceIdentifier.builder(Nodes.class)
// A particular node identified by nodeKey
.child(Node.class, node)
- // That is flow capable, only FlowCapableNodes have tables
+ // That is flow capable, only FlowCapableNodes have tables
.augmentation(FlowCapableNode.class)
- // In the table identified by TableKey
+ // In the table identified by TableKey
.child(Table.class, new TableKey((short) 0))
- // A flow identified by flowKey
+ // A flow identified by flowKey
.child(Flow.class, new FlowKey(fb.getId()))
.build();
@Override
public void close() {
+ super.close();
try {
LOG.debug("DropTestProvider stopped.");
if (notificationRegistration != null) {
notificationRegistration.close();
}
- } catch (Exception e) {
- LOG.error("unregistration of notification listener failed", e);
+ } catch (final Exception e) {
+ LOG.warn("unregistration of notification listener failed: {}", e.getMessage());
+ LOG.debug("unregistration of notification listener failed.. ", e);
}
}
/**
* @param notificationService
*/
- public void setNotificationService(NotificationProviderService notificationService) {
+ public void setNotificationService(final NotificationService notificationService) {
this.notificationService = notificationService;
}
}