From: Sharon Aicler Date: Thu, 11 Sep 2014 21:05:11 +0000 (-0700) Subject: bug 1827 XSQL hangs when there is an empty dataset + X-Git-Tag: release/helium~91^2 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=3bdcc1a485bed7a80a1821fdb44e73a7ca523f1d bug 1827 XSQL hangs when there is an empty dataset + Add Configuration datastore. Change-Id: I95a712640d15282e0d4ba3e68b5f315ddb4e83dd Signed-off-by: Sharon Aicler --- diff --git a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLAdapter.java b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLAdapter.java index 496f27ecaa..96ddb9e0ce 100644 --- a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLAdapter.java +++ b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLAdapter.java @@ -126,7 +126,7 @@ public class XSQLAdapter extends Thread implements SchemaContextListener { return this.bluePrint; } - public List collectModuleRoots(XSQLBluePrintNode table) { + public List collectModuleRoots(XSQLBluePrintNode table,LogicalDatastoreType type) { if (table.getParent().isModule()) { try { List result = new LinkedList(); @@ -136,8 +136,9 @@ public class XSQLAdapter extends Thread implements SchemaContextListener { .toInstance(); DOMDataReadTransaction t = this.domDataBroker .newReadOnlyTransaction(); - Object node = t.read(LogicalDatastoreType.OPERATIONAL, + Object node = t.read(type, instanceIdentifier).get(); + node = XSQLODLUtils.get(node, "reference"); if (node == null) { return result; @@ -157,14 +158,18 @@ public class XSQLAdapter extends Thread implements SchemaContextListener { XSQLAdapter.log(err); } } else { - return collectModuleRoots(table.getParent()); + return collectModuleRoots(table.getParent(),type); } return null; } public void execute(JDBCResultSet rs) { List tables = rs.getTables(); - List roots = collectModuleRoots(tables.get(0)); + List roots = collectModuleRoots(tables.get(0),LogicalDatastoreType.OPERATIONAL); + roots.addAll(collectModuleRoots(tables.get(0),LogicalDatastoreType.CONFIGURATION)); + if(roots.isEmpty()){ + rs.setFinished(true); + } XSQLBluePrintNode main = rs.getMainTable(); List tasks = new LinkedList();