AsyncServicePool(Ticker ticker, ServicePool<S> pool, boolean shutdownPoolOnClose, ExecutorService executor, boolean shutdownExecutorOnClose, MetricRegistry metrics) { _ticker = checkNotNull(ticker); _pool = checkNotNull(pool); _shutdownPoolOnClose = shutdownPoolOnClose; _executor = checkNotNull(executor); _shutdownExecutorOnClose = shutdownExecutorOnClose; _metrics = Metrics.forInstance(metrics, this, _pool.getServiceName()); _executionTime = _metrics.timer("execution-time"); _numExecuteSuccesses = _metrics.meter("num-execute-successes"); _numExecuteFailures = _metrics.meter("num-execute-failures"); _executeBatchSize = _metrics.histogram("execute-batch-size"); }
throw new NoAvailableHostsException(String.format("No hosts discovered for service %s", _pool.getServiceName()));
throw new NoAvailableHostsException(String.format("No hosts discovered for service %s", _pool.getServiceName()));
if (Iterables.isEmpty(allEndPoints)) { throw (lastException == null) ? new NoAvailableHostsException(String.format("No endpoints discovered for service %s", getServiceName())) : new NoAvailableHostsException(lastException.getMessage(), lastException); if (Iterables.isEmpty(validEndPoints)) { throw (lastException == null) ? new OnlyBadHostsException(String.format("No valid endpoints discovered for service %s, all endpoints: %s", getServiceName(), allEndPoints)) : new OnlyBadHostsException(lastException.getMessage(), lastException); if (endPoint == null) { throw (lastException == null) ? new NoSuitableHostsException(String.format("No suitable endpoint discovered for service %s from valid endpoints %s", getServiceName(), validEndPoints)) : new NoSuitableHostsException(lastException);
if (Iterables.isEmpty(allEndPoints)) { throw (lastException == null) ? new NoAvailableHostsException(String.format("No endpoints discovered for service %s", getServiceName())) : new NoAvailableHostsException(lastException.getMessage(), lastException); if (Iterables.isEmpty(validEndPoints)) { throw (lastException == null) ? new OnlyBadHostsException(String.format("No valid endpoints discovered for service %s, all endpoints: %s", getServiceName(), allEndPoints)) : new OnlyBadHostsException(lastException.getMessage(), lastException); if (endPoint == null) { throw (lastException == null) ? new NoSuitableHostsException(String.format("No suitable endpoint discovered for service %s from valid endpoints %s", getServiceName(), validEndPoints)) : new NoSuitableHostsException(lastException);
AsyncServicePool(Ticker ticker, ServicePool<S> pool, boolean shutdownPoolOnClose, ExecutorService executor, boolean shutdownExecutorOnClose, MetricRegistry metrics) { _ticker = checkNotNull(ticker); _pool = checkNotNull(pool); _shutdownPoolOnClose = shutdownPoolOnClose; _executor = checkNotNull(executor); _shutdownExecutorOnClose = shutdownExecutorOnClose; _metrics = Metrics.forInstance(metrics, this, _pool.getServiceName()); _executionTime = _metrics.timer("execution-time"); _numExecuteSuccesses = _metrics.meter("num-execute-successes"); _numExecuteFailures = _metrics.meter("num-execute-failures"); _executeBatchSize = _metrics.histogram("execute-batch-size"); }