| | |
| | | |
| | | |
| | | protected AbstractLoadBalancingAlgorithm( |
| | | ConnectionFactory<?>... factories) |
| | | ConnectionFactory... factories) |
| | | { |
| | | Validator.ensureNotNull((Object[]) factories); |
| | | factoryList = new ArrayList<MonitoredConnectionFactory>( |
| | | factories.length); |
| | | for (ConnectionFactory<?> f : factories) |
| | | for (ConnectionFactory f : factories) |
| | | { |
| | | factoryList.add(new MonitoredConnectionFactory(f)); |
| | | } |
| | |
| | | |
| | | |
| | | protected class MonitoredConnectionFactory extends |
| | | AbstractConnectionFactory<AsynchronousConnection> implements |
| | | AbstractConnectionFactory implements |
| | | ResultHandler<AsynchronousConnection> |
| | | { |
| | | private final ConnectionFactory<?> factory; |
| | | private final ConnectionFactory factory; |
| | | |
| | | private volatile boolean isOperational; |
| | | |
| | |
| | | |
| | | |
| | | |
| | | private MonitoredConnectionFactory(ConnectionFactory<?> factory) |
| | | private MonitoredConnectionFactory(ConnectionFactory factory) |
| | | { |
| | | this.factory = factory; |
| | | this.isOperational = true; |
| | |
| | | |
| | | |
| | | |
| | | public FutureResult<? extends AsynchronousConnection> getAsynchronousConnection( |
| | | final ResultHandler<? super AsynchronousConnection> resultHandler) |
| | | public FutureResult<AsynchronousConnection> getAsynchronousConnection( |
| | | final ResultHandler<AsynchronousConnection> resultHandler) |
| | | { |
| | | ResultHandler<AsynchronousConnection> handler = new ResultHandler<AsynchronousConnection>() |
| | | { |