Tabnine Logo
ConnectionException
Code IndexAdd Tabnine to your IDE (free)

How to use
ConnectionException
in
com.netflix.astyanax.connectionpool.exceptions

Best Java code snippets using com.netflix.astyanax.connectionpool.exceptions.ConnectionException (Showing top 20 results out of 315)

origin: apache/usergrid

private void addKeyspace (Cluster cluster, String keyspaceName) throws Exception {
  try {
    keyspaces.put( keyspaceName, cluster.getKeyspace( keyspaceName ) );
  } catch (ConnectionException e) {
    logger.error("Unable to get keyspace client for keyspace: {}, detail: {}",
      keyspaceName,
      e.getMessage());
    throw e;
  }
}
origin: com.bazaarvoice.astyanax/astyanax-core

  private void informException(ConnectionException connectionException) throws ConnectionException {
    connectionException
      .setHost(getCurrentHost())
      .setLatency(System.currentTimeMillis() - startTime)
      .setAttempt(this.attemptCounter)
      .setLatencyWithPool(System.currentTimeMillis() - poolStartTime);

    if (connectionException instanceof IsRetryableException) {
      if (!canRetry()) {
        throw connectionException;
      }
    }
    else {
      // Most likely an operation error
      throw connectionException;
    }
  }        
}
origin: stackoverflow.com

 try {
  JSONObject json = jParser.makeHttpRequest(url_list_rs, "GET",
      params);
catch(ConnectionException ex) {
  ex.printStackTrace();
}
origin: com.netflix.astyanax/astyanax-core

  .setLatency(System.currentTimeMillis() - startTime);
throw new InterruptedOperationException("Thread interrupted waiting for connection")
  .setHost(getHost())
  .setLatency(System.currentTimeMillis() - startTime);
origin: com.bazaarvoice.astyanax/astyanax-thrift

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;
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;
origin: com.netflix.astyanax/astyanax-test

} catch (ConnectionException e) {
  Assert.fail();
  LOG.info(e.getMessage());
  e.printStackTrace();
origin: com.netflix.astyanax/astyanax-core

@Override
public void open() throws ConnectionException {
  TestHostType type = TestHostType.get(getHost().getPort());
  try {
    type.open(0);
    isOpen = true;
    monitor.incConnectionCreated(getHost());
  } catch (ConnectionException e) {
    lastException = e;
    e.setHost(getHost());
    monitor.incConnectionCreateFailed(getHost(), e);
    throw e;
  }
}
origin: com.bazaarvoice.astyanax/astyanax-core

  @SuppressWarnings("unchecked")
  public <R> ExecuteWithFailover<CL, R> newExecuteWithFailover(Operation<CL, R> operation) throws ConnectionException {
    try {
      if (operation.getPinnedHost() != null) {
        HostConnectionPool<CL> pool = hosts.get(operation.getPinnedHost());
        if (pool == null) {
          throw new NoAvailableHostsException("Host " + operation.getPinnedHost() + " not active");
        }
        return new RoundRobinExecuteWithFailover<CL, R>(config, monitor,
            Arrays.<HostConnectionPool<CL>> asList(pool), 0);
      }
      
      int index = roundRobinCounter.incrementAndGet();
      if (index > MAX_RR_COUNTER) {
        roundRobinCounter.set(0);
      }
      
      return new RoundRobinExecuteWithFailover<CL, R>(config, monitor, topology.getAllPools().getPools(), index);
    }
    catch (ConnectionException e) {
      monitor.incOperationFailure(e.getHost(), e);
      throw e;
    }
  }
}
origin: com.netflix.astyanax/astyanax-core

  private void informException(ConnectionException connectionException) throws ConnectionException {
    connectionException
      .setHost(getCurrentHost())
      .setLatency(System.currentTimeMillis() - startTime)
      .setAttempt(this.attemptCounter)
      .setLatencyWithPool(System.currentTimeMillis() - poolStartTime);

    if (connectionException instanceof IsRetryableException) {
      if (!canRetry()) {
        throw connectionException;
      }
    }
    else {
      // Most likely an operation error
      throw connectionException;
    }
  }        
}
origin: stackoverflow.com

try {
   BluetoothDiscoverer.findPrinters(this, new DiscoveryHandler() {
     public void foundPrinter(DiscoveredPrinter printer) {
       String macAddress = printer.address;
       //I found a printer! I can use the properties of a Discovered printer (address) to make a Bluetooth Connection
     }
     public void discoveryFinished() {
       //Discovery is done
     }
     public void discoveryError(String message) {
       //Error during discovery
     }
   });
 } catch (ConnectionException e) {
   e.printStackTrace();
 } catch (InterruptedException e) {
   e.printStackTrace();
 }
origin: com.bazaarvoice.astyanax/astyanax-core

  .setLatency(System.currentTimeMillis() - startTime);
throw new InterruptedOperationException("Thread interrupted waiting for connection")
  .setHost(getHost())
  .setLatency(System.currentTimeMillis() - startTime);
origin: com.netflix.astyanax/astyanax-thrift

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;
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;
origin: com.bazaarvoice.astyanax/astyanax-core

@Override
public void open() throws ConnectionException {
  TestHostType type = TestHostType.get(getHost().getPort());
  try {
    type.open(0);
    isOpen = true;
    monitor.incConnectionCreated(getHost());
  } catch (ConnectionException e) {
    lastException = e;
    e.setHost(getHost());
    monitor.incConnectionCreateFailed(getHost(), e);
    throw e;
  }
}
origin: com.netflix.astyanax/astyanax-core

  @SuppressWarnings("unchecked")
  public <R> ExecuteWithFailover<CL, R> newExecuteWithFailover(Operation<CL, R> operation) throws ConnectionException {
    try {
      if (operation.getPinnedHost() != null) {
        HostConnectionPool<CL> pool = hosts.get(operation.getPinnedHost());
        if (pool == null) {
          throw new NoAvailableHostsException("Host " + operation.getPinnedHost() + " not active");
        }
        return new RoundRobinExecuteWithFailover<CL, R>(config, monitor,
            Arrays.<HostConnectionPool<CL>> asList(pool), 0);
      }
      
      int index = roundRobinCounter.incrementAndGet();
      if (index > MAX_RR_COUNTER) {
        roundRobinCounter.set(0);
      }
      
      return new RoundRobinExecuteWithFailover<CL, R>(config, monitor, topology.getAllPools().getPools(), index);
    }
    catch (ConnectionException e) {
      monitor.incOperationFailure(e.getHost(), e);
      throw e;
    }
  }
}
origin: stackoverflow.com

ce.printStackTrace();
origin: com.netflix.astyanax/astyanax-test

  @Override
  public boolean failure(ConnectionException e) {
    LOG.error(e.getMessage(), e);
    return false;
  }
});
origin: com.netflix.astyanax/astyanax-core

throw new PoolTimeoutException("Fast fail waiting for connection from pool")
    .setHost(getHost())
    .setLatency(System.currentTimeMillis() - startTime);
origin: com.netflix.astyanax/astyanax-core

monitor.incOperationFailure(e.getHost(), e);
throw e;
origin: stackoverflow.com

 MutationBatch m = CassandraAstyanaxConnection.getInstance().getKeyspace().prepareMutationBatch();
 ColumnListMutation<String> clm = m.withRow(CassandraAstyanaxConnection.getInstance().getEmp_cf(), userId);
 for(String key: attributeMap.keySet()){
   clm.putColumn(key, attributeMap.get(key), null);
 }

try {
  m.execute();
} catch (ConnectionException e) {
  e.printStackTrace();
}
origin: com.netflix.astyanax/astyanax-test

  @Override
  public boolean onException(ConnectionException e) {
    Assert.fail(e.getMessage());
    return true;
  }
}).execute();
com.netflix.astyanax.connectionpool.exceptionsConnectionException

Javadoc

Connection exception caused by an error in the connection pool or a transport error related to the connection itself. Application errors are derived from OperationException.

Most used methods

  • getMessage
  • printStackTrace
  • setHost
  • setLatency
  • getHost
  • setAttempt
  • setLatencyWithPool

Popular in Java

  • Running tasks concurrently on multiple threads
  • getExternalFilesDir (Context)
  • compareTo (BigDecimal)
  • getContentResolver (Context)
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • Dictionary (java.util)
    Note: Do not use this class since it is obsolete. Please use the Map interface for new implementatio
  • Iterator (java.util)
    An iterator over a sequence of objects, such as a collection.If a collection has been changed since
  • JTextField (javax.swing)
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now