@Override public void shutdown() { isReconnecting.set(true); isShutdown.set(true); discardIdleConnections(); config.getLatencyScoreStrategy().removeInstance(this.latencyStrategy); config.getBadHostDetector().removeInstance(this.badHostDetector); }
@Override public void shutdown() { isReconnecting.set(true); isShutdown.set(true); discardIdleConnections(); config.getLatencyScoreStrategy().removeInstance(this.latencyStrategy); config.getBadHostDetector().removeInstance(this.badHostDetector); }
public SimpleHostConnectionPool(Host host, ConnectionFactory<CL> factory, ConnectionPoolMonitor monitor, ConnectionPoolConfiguration config, Listener<CL> listener) { this.host = host; this.config = config; this.factory = factory; this.listener = listener; this.retryContext = config.getRetryBackoffStrategy().createInstance(); this.latencyStrategy = config.getLatencyScoreStrategy().createInstance(); this.badHostDetector = config.getBadHostDetector().createInstance(); this.monitor = monitor; this.availableConnections = new LinkedBlockingQueue<Connection<CL>>(); this.executor = config.getHostReconnectExecutor(); Preconditions.checkNotNull(config.getHostReconnectExecutor(), "HostReconnectExecutor cannot be null"); }
/** * @param config * @param factory * @param monitor */ public AbstractHostPartitionConnectionPool(ConnectionPoolConfiguration config, ConnectionFactory<CL> factory, ConnectionPoolMonitor monitor) { this.config = config; this.factory = factory; this.monitor = monitor; this.hosts = new NonBlockingHashMap<Host, HostConnectionPool<CL>>(); this.topology = new TokenPartitionedTopology<CL>(config.getPartitioner(), config.getLatencyScoreStrategy()); this.partitioner = config.getPartitioner(); }
/** * @param config * @param factory * @param monitor */ public AbstractHostPartitionConnectionPool(ConnectionPoolConfiguration config, ConnectionFactory<CL> factory, ConnectionPoolMonitor monitor) { this.config = config; this.factory = factory; this.monitor = monitor; this.hosts = new NonBlockingHashMap<Host, HostConnectionPool<CL>>(); this.topology = new TokenPartitionedTopology<CL>(config.getPartitioner(), config.getLatencyScoreStrategy()); this.partitioner = config.getPartitioner(); }
public SimpleHostConnectionPool(Host host, ConnectionFactory<CL> factory, ConnectionPoolMonitor monitor, ConnectionPoolConfiguration config, Listener<CL> listener) { this.host = host; this.config = config; this.factory = factory; this.listener = listener; this.retryContext = config.getRetryBackoffStrategy().createInstance(); this.latencyStrategy = config.getLatencyScoreStrategy().createInstance(); this.badHostDetector = config.getBadHostDetector().createInstance(); this.monitor = monitor; this.availableConnections = new LinkedBlockingQueue<Connection<CL>>(); this.executor = config.getHostReconnectExecutor(); Preconditions.checkNotNull(config.getHostReconnectExecutor(), "HostReconnectExecutor cannot be null"); }
/** * Clean up resources associated with the conn pool */ @Override public void shutdown() { ConnectionPoolMBeanManager.getInstance().unregisterMonitor(config.getName(), this); for (Entry<Host, HostConnectionPool<CL>> pool : hosts.entrySet()) { pool.getValue().shutdown(); } config.getLatencyScoreStrategy().shutdown(); config.shutdown(); }
/** * Clean up resources associated with the conn pool */ @Override public void shutdown() { ConnectionPoolMBeanManager.getInstance().unregisterMonitor(config.getName(), this); for (Entry<Host, HostConnectionPool<CL>> pool : hosts.entrySet()) { pool.getValue().shutdown(); } config.getLatencyScoreStrategy().shutdown(); config.shutdown(); }
/** * Starts the conn pool and resources associated with it */ @Override public void start() { ConnectionPoolMBeanManager.getInstance().registerMonitor(config.getName(), this); String seeds = config.getSeeds(); if (seeds != null && !seeds.isEmpty()) { setHosts(config.getSeedHosts()); } config.getLatencyScoreStrategy().start(new Listener() { @Override public void onUpdate() { rebuildPartitions(); } @Override public void onReset() { rebuildPartitions(); } }); }
/** * Starts the conn pool and resources associated with it */ @Override public void start() { ConnectionPoolMBeanManager.getInstance().registerMonitor(config.getName(), this); String seeds = config.getSeeds(); if (seeds != null && !seeds.isEmpty()) { setHosts(config.getSeedHosts()); } config.getLatencyScoreStrategy().start(new Listener() { @Override public void onUpdate() { rebuildPartitions(); } @Override public void onReset() { rebuildPartitions(); } }); }