Class CassandraService
- java.lang.Object
-
- com.palantir.atlasdb.keyvalue.cassandra.pool.CassandraService
-
- All Implemented Interfaces:
AutoCloseable
public class CassandraService extends Object implements AutoCloseable
-
-
Constructor Summary
Constructors Constructor Description CassandraService(com.palantir.atlasdb.util.MetricsManager metricsManager, CassandraKeyValueServiceConfig config, com.palantir.refreshable.Refreshable<CassandraKeyValueServiceRuntimeConfig> runtimeConfig, Blacklist blacklist, CassandraClientPoolMetrics poolMetrics)
-
Method Summary
-
-
-
Constructor Detail
-
CassandraService
public CassandraService(com.palantir.atlasdb.util.MetricsManager metricsManager, CassandraKeyValueServiceConfig config, com.palantir.refreshable.Refreshable<CassandraKeyValueServiceRuntimeConfig> runtimeConfig, Blacklist blacklist, CassandraClientPoolMetrics poolMetrics)
-
-
Method Detail
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
-
refreshTokenRangesAndGetServers
public com.google.common.collect.ImmutableMap<CassandraServer,CassandraServerOrigin> refreshTokenRangesAndGetServers()
-
getCurrentServerListFromConfig
public com.google.common.collect.ImmutableMap<CassandraServer,CassandraServerOrigin> getCurrentServerListFromConfig()
It is expected that config provides list of servers that are directly reachable and do not require special IP resolution.
-
getLocalHosts
public Set<CassandraServer> getLocalHosts()
-
getRandomGoodHostForPredicate
public Optional<CassandraClientPoolingContainer> getRandomGoodHostForPredicate(Predicate<CassandraServer> predicate)
-
getRandomGoodHostForPredicate
public Optional<CassandraClientPoolingContainer> getRandomGoodHostForPredicate(Predicate<CassandraServer> predicate, Set<CassandraServer> triedNodes)
-
getAllNonBlacklistedHosts
public List<com.palantir.common.pooling.PoolingContainer<CassandraClient>> getAllNonBlacklistedHosts()
-
getRandomGoodHost
public CassandraClientPoolingContainer getRandomGoodHost()
-
getTokenMap
public com.google.common.collect.RangeMap<LightweightOppToken,com.google.common.collect.ImmutableSet<CassandraServer>> getTokenMap()
-
getPools
public Map<CassandraServer,CassandraClientPoolingContainer> getPools()
-
debugLogStateOfPool
public void debugLogStateOfPool()
-
getRandomCassandraNodeForKey
public CassandraServer getRandomCassandraNodeForKey(byte[] key)
-
createPool
public CassandraClientPoolingContainer createPool(CassandraServer server)
-
addPool
public void addPool(CassandraServer server)
-
addPool
public void addPool(CassandraServer cassandraServer, CassandraClientPoolingContainer container)
-
removePool
public CassandraClientPoolingContainer removePool(CassandraServer removedServerAddress)
Removes the pool from the set of current pools. Note that this shuts down all idle connections, but active ones remain alive until they are returned to the pool, whereby they are destroyed immediately. Threads waiting on the pool will be interrupted.
-
cacheInitialCassandraHosts
public void cacheInitialCassandraHosts()
-
clearInitialCassandraHosts
public void clearInitialCassandraHosts()
-
-