Merge "BUG-2801: Added filtering for get and getConfig in netconf mdsal northbound."
authorTony Tkacik <ttkacik@cisco.com>
Mon, 23 Mar 2015 10:06:39 +0000 (10:06 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Mon, 23 Mar 2015 10:06:40 +0000 (10:06 +0000)
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DistributedDataStore.java
opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCProxy.java
opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCResultSet.java
opendaylight/netconf/netconf-netty-util/src/main/java/org/opendaylight/controller/netconf/nettyutil/AbstractNetconfSessionNegotiator.java

index 3029ef7e399a4db99c6ed2ad18a7e7701cb2f8ee..5ade98cb86106a7b65d82251dccced95c93f0914 100644 (file)
@@ -178,11 +178,13 @@ public class DistributedDataStore implements DOMStore, SchemaContextListener,
         LOG.info("Beginning to wait for data store to become ready : {}", type);
 
         try {
-            waitTillReadyCountDownLatch.await(waitTillReadyTimeInMillis, TimeUnit.MILLISECONDS);
-
-            LOG.debug("Data store {} is now ready", type);
+            if (waitTillReadyCountDownLatch.await(waitTillReadyTimeInMillis, TimeUnit.MILLISECONDS)) {
+                LOG.debug("Data store {} is now ready", type);
+            } else {
+                LOG.error("Shared leaders failed to settle in {} seconds, giving up", TimeUnit.MILLISECONDS.toSeconds(waitTillReadyTimeInMillis));
+            }
         } catch (InterruptedException e) {
-            LOG.error("Interrupted when trying to wait for shards to become leader in a reasonable amount of time - giving up");
+            LOG.error("Interrupted while waiting for shards to settle", e);
         }
     }
 
index 7e29947a01888b57c5039e02a35c981b2bc8eb9f..fb9aeb0e16d5e2dc2d26db20a8be2742efb342ef 100644 (file)
@@ -2,9 +2,11 @@ package org.opendaylight.controller.md.sal.dom.xsql.jdbc;
 
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Method;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class JDBCProxy implements InvocationHandler {
-
+    private static final Logger LOG = LoggerFactory.getLogger(JDBCProxy.class);
     private Object myObject = null;
     private Class<?> myObjectClass = null;
 
@@ -14,11 +16,8 @@ public class JDBCProxy implements InvocationHandler {
     }
 
     @Override
-    public Object invoke(Object proxy, Method method, Object[] args)
-            throws Throwable {
-        System.err.println("Class " + this.myObjectClass.getSimpleName()
-                + " Method " + method.getName());
+    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+        LOG.debug("Class {} Method {}", this.myObjectClass.getSimpleName(), method.getName());
         return method.invoke(this.myObject, args);
     }
-
 }
index 757f1a8b0487d675661bc35c45ef8a38ae1c6861..6689908204e19e9aced43dccbb28d2dd5a8f2c07 100644 (file)
@@ -41,6 +41,9 @@ import org.opendaylight.controller.md.sal.dom.xsql.XSQLODLUtils;
 public class JDBCResultSet implements Serializable, ResultSet,
         ResultSetMetaData {
     private static final long serialVersionUID = -7450200738431047057L;
+    private static final ClassLoader CLASS_LOADER = JDBCResultSet.class.getClassLoader();
+    private static final Class<?>[] PROXY_INTERFACES = new Class[] { ResultSet.class };
+    private static int nextID = 0;
 
     private String sql = null;
     private List<XSQLBluePrintNode> tablesInQuery = new ArrayList<XSQLBluePrintNode>();
@@ -50,7 +53,6 @@ public class JDBCResultSet implements Serializable, ResultSet,
     private transient Map<String, Object> currentRecord = null;
     private boolean finished = false;
     private int id = 0;
-    private static Integer nextID = new Integer(0);
     public int numberOfTasks = 0;
     private Map<String, Map<XSQLColumn, List<XSQLCriteria>>> criteria = new ConcurrentHashMap<String, Map<XSQLColumn, List<XSQLCriteria>>>();
     private Exception err = null;
@@ -58,7 +60,7 @@ public class JDBCResultSet implements Serializable, ResultSet,
     private transient Map<String,JDBCResultSet> subQueries = new HashMap<String,JDBCResultSet>();
 
     public ResultSet getProxy() {
-         return (ResultSet) Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class[] {ResultSet.class }, new JDBCProxy(this));
+         return (ResultSet) Proxy.newProxyInstance(CLASS_LOADER, PROXY_INTERFACES, new JDBCProxy(this));
     }
 
     public void setSQL(String _sql) {
index 6d4c1067b8455e377c47dd3e3de84abae15b4785..9e1edc337661fc808f1dc50e549b0bdeb3e6ae68 100644 (file)
@@ -27,6 +27,7 @@ import org.opendaylight.controller.netconf.api.NetconfDocumentedException;
 import org.opendaylight.controller.netconf.api.NetconfMessage;
 import org.opendaylight.controller.netconf.api.NetconfSessionListener;
 import org.opendaylight.controller.netconf.api.NetconfSessionPreferences;
+import org.opendaylight.controller.netconf.api.xml.XmlNetconfConstants;
 import org.opendaylight.controller.netconf.nettyutil.handler.FramingMechanismHandlerFactory;
 import org.opendaylight.controller.netconf.nettyutil.handler.NetconfChunkAggregator;
 import org.opendaylight.controller.netconf.nettyutil.handler.NetconfMessageToXMLEncoder;
@@ -229,9 +230,9 @@ public abstract class AbstractNetconfSessionNegotiator<P extends NetconfSessionP
     }
 
     private boolean containsBase11Capability(final Document doc) {
-        final NodeList nList = doc.getElementsByTagName("capability");
+        final NodeList nList = doc.getElementsByTagName(XmlNetconfConstants.CAPABILITY);
         for (int i = 0; i < nList.getLength(); i++) {
-            if (nList.item(i).getTextContent().contains("base:1.1")) {
+            if (nList.item(i).getTextContent().contains(XmlNetconfConstants.URN_IETF_PARAMS_NETCONF_BASE_1_1)) {
                 return true;
             }
         }