Package org.voltdb.client

Examples of org.voltdb.client.ClientImpl


     * @throws IOException
     */
    private ClientImpl createClientAndConnect() throws UnknownHostException, IOException
    {
        // Make client connections.
        ClientImpl clientTmp = (ClientImpl) ClientFactory.createClient(this.config);
        // ENG-6231: Only fail if we can't connect to any of the provided servers.
        boolean connectedAnything = false;
        for (String server : this.servers) {
            try {
                clientTmp.createConnection(server);
                connectedAnything = true;
            }
            catch (UnknownHostException e) {
            }
            catch (IOException e) {
            }
        }

        if (!connectedAnything) {
            try {
                clientTmp.close();
            } catch (InterruptedException ie) {}
            throw new IOException("Unable to connect to VoltDB cluster with servers: " + this.servers);
        }

        this.client.set(clientTmp);
View Full Code Here


     * @throws UnknownHostException
     * @throws IOException
     */
    protected synchronized ClientImpl getClient() throws UnknownHostException, IOException
    {
        ClientImpl retClient = (ClientImpl) this.client.get() ;
        if (retClient != null) {
            return retClient;
        }
        return this.createClientAndConnect();
    }
View Full Code Here

     * @throws ProcCallException
     */
    public ClientResponse execute(String procedure, long timeout, Object... parameters)
            throws NoConnectionsException, IOException, ProcCallException {
        long start = System.currentTimeMillis();
        ClientImpl currentClient = this.getClient();
        try {
            // If connections are lost try reconnecting.
            ClientResponse response = currentClient.callProcedureWithTimeout(procedure, timeout, TimeUnit.SECONDS, parameters);
            return response;
        }
        catch (ProcCallException pce) {
            throw pce;
        }
View Full Code Here

     *         to post the request to the server, true otherwise.
     */
    public boolean executeAsync(ProcedureCallback callback, String procedure, Object... parameters)
            throws NoConnectionsException, IOException
    {
        ClientImpl currentClient = this.getClient();
        try {
            return currentClient.callProcedure(new TrackingCallback(this, procedure, callback),
                    procedure, parameters);
        }
        catch (NoConnectionsException e) {
            this.dropClient(currentClient);
            throw e;
View Full Code Here

     * @return the Future created to wrap around the asynchronous process.
     */
    public Future<ClientResponse> executeAsync(String procedure, Object... parameters)
            throws NoConnectionsException, IOException
    {
        ClientImpl currentClient = this.getClient();
        final JDBC4ExecutionFuture future = new JDBC4ExecutionFuture(this.defaultAsyncTimeout);
        try {
            currentClient.callProcedure(new TrackingCallback(this, procedure, new ProcedureCallback() {
                @SuppressWarnings("unused")
                final JDBC4ExecutionFuture result;
                {
                    this.result = future;
                }
View Full Code Here

     * @throws InterruptedException
     * @throws IOException
     * @see Client#drain()
     */
    public void drain() throws InterruptedException, IOException {
        ClientImpl currentClient = this.getClient();
        if (currentClient == null) {
            throw new IOException("Client is unavailable for drain().");
        }
        currentClient.drain();
    }
View Full Code Here

     *
     * @throws InterruptedException
     * @throws IOException
     */
    public void backpressureBarrier() throws InterruptedException, IOException {
        ClientImpl currentClient = this.getClient();
        if (currentClient == null) {
            throw new IOException("Client is unavailable for backpressureBarrier().");
        }
        currentClient.backpressureBarrier();
    }
View Full Code Here

     * @throws ProcCallException
     */
    public ClientResponse updateApplicationCatalog(File catalogPath, File deploymentPath)
            throws IOException, NoConnectionsException, ProcCallException
    {
        ClientImpl currentClient = this.getClient();
        try {
            return currentClient.updateApplicationCatalog(catalogPath, deploymentPath);
        }
        catch (NoConnectionsException e) {
            this.dropClient(currentClient);
            throw e;
        }
View Full Code Here

TOP

Related Classes of org.voltdb.client.ClientImpl

Copyright © 2018 www.massapicom. 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.