Package com.netflix.astyanax.connectionpool.exceptions

Examples of com.netflix.astyanax.connectionpool.exceptions.ConnectionException


                    pool.addLatencySample(latency, now);
                    return new OperationResultImpl<R>(result.getHost(), result.getResult(), latency);
                } catch (Exception e) {
                    long now = System.nanoTime();
                    latency = now - startTime;
                    ConnectionException connectionException;
                    if (!(e instanceof ConnectionException))
                        connectionException = new UnknownException(e);
                    else
                        connectionException = (ConnectionException)e;
                    connectionException.setLatency(latency);
                   
                    if (!(connectionException instanceof IsTimeoutException)) {
                        pool.addLatencySample(latency, now);
                    }
                    else {
View Full Code Here


                                    .getKeySerializer(), columnFamily.getColumnSerializer());
                            try {
                                callback.success(rows);
                            }
                            catch (Throwable t) {
                                ConnectionException ce = ThriftConverter.ToConnectionPoolException(t);
                                error.set(ce);
                                return false;
                            }
                           
                            if (bContinue) {
                                // Determine the start token for the next page
                                String token = partitioner.getTokenForKey(lastRow.bufferForKey()).toString();
                                checkpointManager.trackCheckpoint(tokenPair.left, token);
                                if (getRepeatLastToken()) {
                                    range.setStart_token(partitioner.getTokenMinusOne(token));
                                }
                                else {
                                    range.setStart_token(token);
                                }
                            }
                            else {
                                checkpointManager.trackCheckpoint(tokenPair.left, tokenPair.right);
                                return false;
                            }
                        }
                        else {
                            checkpointManager.trackCheckpoint(tokenPair.left, tokenPair.right);
                            return false;
                        }
                    }
                    catch (Exception e) {
                        ConnectionException ce = ThriftConverter.ToConnectionPoolException(e);
                        if (!callback.failure(ce)) {
                            error.set(ce);
                            return false;
                        }
                    }
View Full Code Here

            R result = internalExecute(client, state);
            tracer.success();
            return result;
        }
        catch (Exception e) {
            ConnectionException ce = ThriftConverter.ToConnectionPoolException(e);
            tracer.failure(ce);
            throw ce;
        }
    }
View Full Code Here

     * @throws OperationException
     * @throws ConnectionException
     */
    private synchronized <R> OperationResult<R> executeDdlOperation(AbstractOperationImpl<R> operation, RetryPolicy retry)
             throws OperationException, ConnectionException {
         ConnectionException lastException = null;
         for (int i = 0; i < 2; i++) {
             operation.setPinnedHost(ddlHost);
             try {
                 OperationResult<R> result = connectionPool.executeWithFailover(operation, retry);
                 ddlHost = result.getHost();
View Full Code Here

  }

  @Override
  public OperationResult<R> execute() throws ConnectionException {
   
        ConnectionException lastException = null;
       
        retry.begin();

        do {
          try {
View Full Code Here

                }
            }
            catch (Exception e) {
                pool.addLatencySample(TimeUnit.NANOSECONDS.convert(cpConfig.getSocketTimeout(), TimeUnit.MILLISECONDS), System.nanoTime());
                closeClient();
                ConnectionException ce = ThriftConverter.ToConnectionPoolException(e).setHost(getHost())
                        .setLatency(System.currentTimeMillis() - startTime);
                monitor.incConnectionCreateFailed(getHost(), ce);
                throw ce;
            }
            catch (Throwable t) {
                LOG.error("Error creating connection", t);
                pool.addLatencySample(TimeUnit.NANOSECONDS.convert(cpConfig.getSocketTimeout(), TimeUnit.MILLISECONDS), System.nanoTime());
                closeClient();
                ConnectionException ce = ThriftConverter.ToConnectionPoolException(new RuntimeException("Error openning connection", t)).setHost(getHost())
                        .setLatency(System.currentTimeMillis() - startTime);
                monitor.incConnectionCreateFailed(getHost(), ce);
                throw ce;
            }
        }
View Full Code Here

    @Override
    public boolean returnConnection(Connection<CL> connection) {
        returnedCount.incrementAndGet();
        monitor.incConnectionReturned(host);

        ConnectionException ce = connection.getLastException();
        if (ce != null) {
            if (ce instanceof IsDeadConnectionException) {
                noteError(ce);
                internalCloseConnection(connection);
                return true;
View Full Code Here

            throw e;
        }
        catch (Throwable t) {
            failedOpenConnections.incrementAndGet();
            activeCount.decrementAndGet();
            ConnectionException ce = new UnknownException(t);
            noteError(ce);
            throw ce;
        }
    }
View Full Code Here

     */
    @Override
    public <R> OperationResult<R> executeWithFailover(Operation<CL, R> op, RetryPolicy retry)
            throws ConnectionException {
        retry.begin();
        ConnectionException lastException = null;
        do {
            try {
                OperationResult<R> result = newExecuteWithFailover(op).tryOperation(op);
                retry.success();
                return result;
View Full Code Here

*
* @see {@link RetryPolicy}
*/
public abstract class AbstractExecutionImpl<R> implements Execution<R> {
    public OperationResult<R> executeWithRetry(RetryPolicy retry) throws ConnectionException {
        ConnectionException lastException = null;
        retry.begin();
        do {
            try {
                return execute();
            }
View Full Code Here

TOP

Related Classes of com.netflix.astyanax.connectionpool.exceptions.ConnectionException

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.