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; } }
public boolean isBootstrapping() { if ( getCause() instanceof BadRequestException ) { BadRequestException bre = (BadRequestException)getCause(); String msg = bre.getMessage(); if ( (msg.contains("Keyspace") && msg.contains( "does not exist" )) || msg.contains("unconfigured columnfamily")) { return true; } } return false; }
throw new SerializationException( "Unable to de-serialze. Expected version " + VERSION + " but was version " + version ); throw new SerializationException( "The total size we expected was different. Stored total size is " + expectedTotalSize + " but actual buffer size is " + totalSize );
@Override public void open(long timeout) throws ConnectionException { double p = new Random().nextDouble(); if (p < 0.002) { throw new HostDownException("HostDownException"); } else if (p < 0.004) { throw new TimeoutException("HostDownException"); } else if (p < 0.006) { throw new TransportException("TransportException"); } think(200); }
@Override public <R> OperationResult<R> execute( HostConnectionPool<TestClient> pool, Operation<TestClient, R> op) throws ConnectionException { throw new TransportException("TransportException"); }
@Override public void open(long timeout) throws ConnectionException { throw new BadRequestException("BadRequestException"); } },
@Override public <R> OperationResult<R> execute( HostConnectionPool<TestClient> pool, Operation<TestClient, R> op) throws ConnectionException { think(2000); throw new TimeoutException("SocketTimeException"); }
@Override public <R> OperationResult<R> execute( HostConnectionPool<TestClient> pool, Operation<TestClient, R> op) throws ConnectionException { throw new OperationTimeoutException("TimedOutException"); }
try { JSONObject json = jParser.makeHttpRequest(url_list_rs, "GET", params); catch(ConnectionException ex) { ex.printStackTrace(); }
@Override public String getMessage() { return this.getOriginalMessage(); } }
@Override public void open(long timeout) throws ConnectionException { double p = new Random().nextDouble(); if (p < 0.002) { throw new HostDownException("HostDownException"); } else if (p < 0.004) { throw new TimeoutException("HostDownException"); } else if (p < 0.006) { throw new TransportException("TransportException"); } think(200); }
@Override public <R> OperationResult<R> execute( HostConnectionPool<TestClient> pool, Operation<TestClient, R> op) throws ConnectionException { throw new TransportException("TransportException"); }
@Override public void open(long timeout) throws ConnectionException { throw new BadRequestException("BadRequestException"); } },
@Override public String getMessage() { return this.getOriginalMessage(); } }
@Override public <R> OperationResult<R> execute( HostConnectionPool<TestClient> pool, Operation<TestClient, R> op) throws ConnectionException { throw new TransportException("TransportException"); }
@Override public <R> OperationResult<R> execute( HostConnectionPool<TestClient> pool, Operation<TestClient, R> op) throws ConnectionException { throw new TransportException("TransportException"); }
@Override public void open(long timeout) throws ConnectionException { if (++retry == 2) { // success } else { throw new TransportException("TransportException"); } } },
@Override public <R> OperationResult<R> execute( HostConnectionPool<TestClient> pool, Operation<TestClient, R> op) throws ConnectionException { throw new TransportException("TransportException"); }
@Override public void open(long timeout) throws ConnectionException { throw new TransportException("TransportException"); } },
@Override public void open(long timeout) throws ConnectionException { throw new TransportException("TransportException"); } },