All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.taobao.tdhs.client.TDHSClient Maven / Gradle / Ivy

There is a newer version: 0.4.1
Show newest version
/*
 * Copyright(C) 2011-2012 Alibaba Group Holding Limited
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License version 2 as
 *  published by the Free Software Foundation.
 *
 *  Authors:
 *    wentong 
 */

package com.taobao.tdhs.client;

import com.taobao.tdhs.client.statement.BatchStatement;
import com.taobao.tdhs.client.statement.Statement;

import java.util.concurrent.TimeUnit;

/**
 * The TDH_Socket Client interface
 *
 * @author 文通
 * @since 11-12-26 下午4:53
 */
public interface TDHSClient extends Statement {

    public static final String CONNECTION_NUMBER = "connectionNumber";
    public static final String TIME_OUT = "timeOut";
    public static final String NEED_RECONNECT = "needReconnect";
    public static final String CONNECT_TIMEOUT = "connectTimeout";
    public static final String CHARSET_NAME = "charsetName";
    public static final String READ_CODE = "readCode";
    public static final String WRITE_CODE = "writeCode";


    /**
     * Method getCharsetName returns the charsetName of this TDHSClient object.
     * like UTF8 for the string encoding when read and send
     *
     * @return the charsetName (type String) of this TDHSClient object.
     */
    String getCharsetName();

    /**
     * Method setCharsetName sets the charsetName of this TDHSClient object.
     * like UTF8 for the string encoding when read and send
     *
     * @param charsetName the charsetName of this TDHSClient object.
     */
    void setCharsetName(String charsetName);


    /**
     * wait for connected
     *
     * @param timeout of type long
     * @param unit    of type TimeUnit
     *
     * @return boolean , true mean connected ,false mean not connected
     */
    boolean awaitForConnected(long timeout, TimeUnit unit);

    /**
     * Method createStatement ...
     * 

* create a statement for one thread * * @return Statement */ Statement createStatement(); /** * Method createStatement ... *

* create a statement for one thread * * @param hash of type int, use hash to make sure the request from this statement will * be run a assigned thread on the server-side * the thread is hash%thread_count * * @return Statement */ Statement createStatement(int hash); /** * create Batch Statement ... * * @return BatchStatement */ BatchStatement createBatchStatement(); /** * shutdown the client * stop the thread for io */ void shutdown(); }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy