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);
}
}
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;
}
@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);
}
-
}
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>();
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;
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) {
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;
}
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;
}
}