Examples of TDHSClient


Examples of com.taobao.tdhs.client.TDHSClient

    public boolean isValid(int timeout) throws SQLException {
        if (isClosed()) {
            return false;
        }
        TDHSClient client = getClient();
        BatchStatement batchStatement = client.createBatchStatement();
        batchStatement.setTimeOut(timeout);
        try {
            batchStatement.commit();
            return true;
        } catch (TDHSException e) {
View Full Code Here

Examples of com.taobao.tdhs.client.TDHSClient

            if (value != null) {
                value.addRefCount();
                key.setClient(value.getClient());
                return key;
            } else {
                TDHSClient tdhsClient =
                        new TDHSClientImpl(key.getAddress(), connectionNumber, timeOut, needReconnect, connectTimeOut,
                                charsetName, readCode, writeCode, lowerCaseTableNames, version);
                value = new ClientValue(tdhsClient);
                instances.put(key, value);
                key.setClient(tdhsClient);
View Full Code Here

Examples of com.taobao.tdhs.client.TDHSClient

     *
     * @param key of type ClientKey
     */
    public void closeConnection(@NotNull ClientKey key) {
        logger.debug("closeConnection ClientKey:" + key);
        TDHSClient client = null;
        lock.lock();
        try {
            ClientValue value = instances.get(key);
            if (value == null) {
                throw new RuntimeException("Don't have this client in instances,Maybe close twice! key is " + key);
            }
            if (value.needCloseClient()) {
                client = value.getClient();
                instances.remove(key);
            }
        } finally {
            lock.unlock();
        }
        if (client != null) {
            logger.debug("closeConnection and shutDown TDHSClient!");
            client.shutdown();
        }
    }
View Full Code Here

Examples of com.taobao.tdhs.client.TDHSClient

*/
public class BetweenTest {

    @Test
    public void testBetween() throws TDHSException {
        TDHSClient client = new TDHSClientImpl(new InetSocketAddress("t-wentong-u.local", 9999), 1);

        TDHSResponse r = client.query().use("test").select("id", "v", "i").from("test").where().fields("i")
                .between(new String[]{"2"},
                        new String[]{"5"}).and().field("i").not("2").and().field("i").not("5").get();

        List<List<String>> fieldData = r.getFieldData();
        for (List<String> fd : fieldData) {
            for (String v : fd) {
                System.out.print(v + " ");
            }
            System.out.print("\n");
        }
        client.shutdown();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.