- private void notifyExistingNodes(final Pattern nodeIdPatternRegex, final EventSourceTopic eventSourceTopic){
-
- final ReadOnlyTransaction tx = dataBroker.newReadOnlyTransaction();
-
- final CheckedFuture<Optional<Topology>, ReadFailedException> future = tx.read(OPERATIONAL, EVENT_SOURCE_TOPOLOGY_PATH);
-
- Futures.addCallback(future, new FutureCallback<Optional<Topology>>(){
-
- @Override
- public void onSuccess(Optional<Topology> data) {
- if(data.isPresent()) {
- final List<Node> nodes = data.get().getNode();
- for (final Node node : nodes) {
- if (nodeIdPatternRegex.matcher(node.getNodeId().getValue()).matches()) {
- eventSourceTopic.notifyNode(EVENT_SOURCE_TOPOLOGY_PATH.child(Node.class, node.getKey()));
- }
- }
- }
- tx.close();
- }
-
- @Override
- public void onFailure(Throwable t) {
- LOG.error("Can not notify existing nodes {}", t);
- tx.close();
- }
-
- });
-
- }
-