use of org.opendaylight.openflowplugin.common.wait.SimpleTaskRetryLooper in project openflowplugin by opendaylight.
the class FlowForwarder method registrationListener.
@SuppressWarnings("IllegalCatch")
private void registrationListener(final DataBroker db) {
final DataTreeIdentifier<Flow> treeId = new DataTreeIdentifier<>(LogicalDatastoreType.CONFIGURATION, getWildCardPath());
try {
SimpleTaskRetryLooper looper = new SimpleTaskRetryLooper(ForwardingRulesManagerImpl.STARTUP_LOOP_TICK, ForwardingRulesManagerImpl.STARTUP_LOOP_MAX_RETRIES);
listenerRegistration = looper.loopUntilNoException(() -> db.registerDataTreeChangeListener(treeId, FlowForwarder.this));
} catch (final Exception e) {
LOG.warn("FRM Flow DataTreeChange listener registration fail!");
LOG.debug("FRM Flow DataTreeChange listener registration fail ..", e);
throw new IllegalStateException("FlowForwarder startup fail! System needs restart.", e);
}
}
use of org.opendaylight.openflowplugin.common.wait.SimpleTaskRetryLooper in project openflowplugin by opendaylight.
the class LLDPPacketPuntEnforcer method start.
@SuppressWarnings("IllegalCatch")
public void start() {
final InstanceIdentifier<FlowCapableNode> path = InstanceIdentifier.create(Nodes.class).child(Node.class).augmentation(FlowCapableNode.class);
final DataTreeIdentifier<FlowCapableNode> identifier = new DataTreeIdentifier<>(LogicalDatastoreType.OPERATIONAL, path);
SimpleTaskRetryLooper looper = new SimpleTaskRetryLooper(STARTUP_LOOP_TICK, STARTUP_LOOP_MAX_RETRIES);
try {
listenerRegistration = looper.loopUntilNoException(() -> dataBroker.registerDataTreeChangeListener(identifier, LLDPPacketPuntEnforcer.this));
} catch (Exception e) {
throw new IllegalStateException("registerDataTreeChangeListener failed", e);
}
}
use of org.opendaylight.openflowplugin.common.wait.SimpleTaskRetryLooper in project openflowplugin by opendaylight.
the class DeviceMastershipManager method registerNodeListener.
@SuppressWarnings("IllegalCatch")
private void registerNodeListener() {
final InstanceIdentifier<FlowCapableNode> flowNodeWildCardIdentifier = InstanceIdentifier.create(Nodes.class).child(Node.class).augmentation(FlowCapableNode.class);
final DataTreeIdentifier<FlowCapableNode> treeId = new DataTreeIdentifier<>(LogicalDatastoreType.OPERATIONAL, flowNodeWildCardIdentifier);
try {
SimpleTaskRetryLooper looper = new SimpleTaskRetryLooper(ForwardingRulesManagerImpl.STARTUP_LOOP_TICK, ForwardingRulesManagerImpl.STARTUP_LOOP_MAX_RETRIES);
listenerRegistration = looper.loopUntilNoException(() -> dataBroker.registerDataTreeChangeListener(treeId, DeviceMastershipManager.this));
} catch (Exception e) {
LOG.warn("Data listener registration failed: {}", e.getMessage());
LOG.debug("Data listener registration failed ", e);
throw new IllegalStateException("Node listener registration failed!", e);
}
}
use of org.opendaylight.openflowplugin.common.wait.SimpleTaskRetryLooper in project openflowplugin by opendaylight.
the class DefaultConfigPusher method start.
@SuppressWarnings("checkstyle:IllegalCatch")
public void start() {
try {
final InstanceIdentifier<FlowCapableNode> path = InstanceIdentifier.create(Nodes.class).child(Node.class).augmentation(FlowCapableNode.class);
final DataTreeIdentifier<FlowCapableNode> identifier = new DataTreeIdentifier<>(LogicalDatastoreType.OPERATIONAL, path);
final SimpleTaskRetryLooper looper = new SimpleTaskRetryLooper(STARTUP_LOOP_TICK, STARTUP_LOOP_MAX_RETRIES);
listenerRegistration = looper.loopUntilNoException(() -> dataBroker.registerDataTreeChangeListener(identifier, DefaultConfigPusher.this));
} catch (Exception e) {
LOG.error("DataTreeChangeListener registration failed: {}", e);
throw new IllegalStateException("DefaultConfigPusher startup failed!", e);
}
LOG.info("DefaultConfigPusher has started.");
}
Aggregations