@Override public Host getPinnedHost() { return next.getPinnedHost(); }
@Override public Host getPinnedHost() { return next.getPinnedHost(); }
@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; } } }
@Override public OperationResult<Void> testOperation(final Operation<?, ?> operation, RetryPolicy retry) throws ConnectionException { return executeOperation( new AbstractKeyspaceOperationImpl<Void>(tracerFactory.newTracer(CassandraOperationType.TEST), operation.getPinnedHost(), getKeyspaceName()) { @Override public Void internalExecute(Client client, ConnectionContext context) throws Exception { operation.execute(null, context); return null; } }, retry); }
@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; } } }
@Override public OperationResult<Void> testOperation(final Operation<?, ?> operation, RetryPolicy retry) throws ConnectionException { return executeOperation( new AbstractKeyspaceOperationImpl<Void>(tracerFactory.newTracer(CassandraOperationType.TEST), operation.getPinnedHost(), getKeyspaceName()) { @Override public Void internalExecute(Client client, ConnectionContext context) throws Exception { operation.execute(null, context); return null; } }, retry); }
boolean isSorted = false; if (op.getPinnedHost() != null) { HostConnectionPool<CL> pool = hosts.get(op.getPinnedHost()); if (pool == null) { throw new NoAvailableHostsException("Host " + op.getPinnedHost() + " not active");
boolean isSorted = false; if (op.getPinnedHost() != null) { HostConnectionPool<CL> pool = hosts.get(op.getPinnedHost()); if (pool == null) { throw new NoAvailableHostsException("Host " + op.getPinnedHost() + " not active");
"] on keyspace [" + op.getKeyspace() + "] on pinned host[" + op.getPinnedHost() + "]");
"] on keyspace [" + op.getKeyspace() + "] on pinned host[" + op.getPinnedHost() + "]");