本文整理汇总了Java中com.netflix.astyanax.connectionpool.ConnectionPoolConfiguration类的典型用法代码示例。如果您正苦于以下问题:Java ConnectionPoolConfiguration类的具体用法?Java ConnectionPoolConfiguration怎么用?Java ConnectionPoolConfiguration使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ConnectionPoolConfiguration类属于com.netflix.astyanax.connectionpool包,在下文中一共展示了ConnectionPoolConfiguration类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createCacheLoader
import com.netflix.astyanax.connectionpool.ConnectionPoolConfiguration; //导入依赖的package包/类
@Override
CacheLoader<DefaultAstyanaxKeyspaceFactory.KeyspaceKey, AstyanaxContext<Keyspace>> createCacheLoader(AstyanaxConfiguration astyanaxConfiguration,
ConnectionPoolConfiguration connectionPoolConfiguration,
KeyspaceConnectionPoolMonitorFactory connectionPoolMonitorFactory,
ClusterHostSupplierFactory hostSupplierFactory,
KeyspaceInitializer keyspaceInitializer) {
final CacheLoader<KeyspaceKey, AstyanaxContext<Keyspace>> delegate = super.createCacheLoader(astyanaxConfiguration, connectionPoolConfiguration, connectionPoolMonitorFactory, hostSupplierFactory, keyspaceInitializer);
return new CacheLoader<KeyspaceKey, AstyanaxContext<Keyspace>>() {
@Override
public AstyanaxContext<Keyspace> load(KeyspaceKey key) throws Exception {
createCount.incrementAndGet();
return delegate.load(key);
}
};
}
示例2: keyspaceFactory
import com.netflix.astyanax.connectionpool.ConnectionPoolConfiguration; //导入依赖的package包/类
@Bean
public AstyanaxKeyspaceFactory keyspaceFactory(AstyanaxConfiguration config,
ConnectionPoolConfiguration poolConfig,
KeyspaceConnectionPoolMonitorFactory connectionPoolMonitorFactory,
ClusterHostSupplierFactory clusterHostSupplierFactory,
KeyspaceInitializer keyspaceInitializer) {
return new DefaultAstyanaxKeyspaceFactory(config, poolConfig, connectionPoolMonitorFactory, clusterHostSupplierFactory, keyspaceInitializer);
}
示例3: DefaultAstyanaxKeyspaceFactory
import com.netflix.astyanax.connectionpool.ConnectionPoolConfiguration; //导入依赖的package包/类
public DefaultAstyanaxKeyspaceFactory(final AstyanaxConfiguration astyanaxConfiguration,
final ConnectionPoolConfiguration connectionPoolConfiguration,
final KeyspaceConnectionPoolMonitorFactory connectionPoolMonitorFactory,
final ClusterHostSupplierFactory clusterHostSupplierFactory,
final KeyspaceInitializer keyspaceInitializer) {
keyspaces = CacheBuilder
.newBuilder()
.removalListener(createRemovalListener())
.build(createCacheLoader(astyanaxConfiguration, connectionPoolConfiguration, connectionPoolMonitorFactory, clusterHostSupplierFactory, keyspaceInitializer));
}
示例4: createCacheLoader
import com.netflix.astyanax.connectionpool.ConnectionPoolConfiguration; //导入依赖的package包/类
CacheLoader<KeyspaceKey, AstyanaxContext<Keyspace>> createCacheLoader(final AstyanaxConfiguration astyanaxConfiguration,
final ConnectionPoolConfiguration connectionPoolConfiguration,
final KeyspaceConnectionPoolMonitorFactory connectionPoolMonitorFactory,
final ClusterHostSupplierFactory clusterHostSupplierFactory,
final KeyspaceInitializer keyspaceInitializer) {
return new CacheLoader<KeyspaceKey, AstyanaxContext<Keyspace>>() {
@Override
public AstyanaxContext<Keyspace> load(KeyspaceKey key) throws Exception {
Supplier<List<Host>> hostSupplier = clusterHostSupplierFactory.createHostSupplier(key.getClusterName());
if (hostSupplier != null) {
hostSupplier.get();
((ConnectionPoolConfigurationImpl) connectionPoolConfiguration).setSeeds(null);
}
AstyanaxContext<Keyspace> context = new AstyanaxContext.Builder()
.forCluster(key.getClusterName())
.forKeyspace(key.getKeyspaceName())
.withAstyanaxConfiguration(astyanaxConfiguration)
.withConnectionPoolConfiguration(connectionPoolConfiguration)
.withConnectionPoolMonitor(connectionPoolMonitorFactory.createMonitorForKeyspace(key.getClusterName(), key.getKeyspaceName()))
.withHostSupplier(hostSupplier)
.buildKeyspace(ThriftFamilyFactory.getInstance());
context.start();
keyspaceInitializer.initKeyspace(context.getClient());
return context;
}
};
}
示例5: getConnectionPoolConfig
import com.netflix.astyanax.connectionpool.ConnectionPoolConfiguration; //导入依赖的package包/类
private ConnectionPoolConfiguration getConnectionPoolConfig ( final String poolName, final int poolSize ){
ConnectionPoolConfiguration config;
final String username = cassandraFig.getUsername();
final String password = cassandraFig.getPassword();
if ( username != null && !username.isEmpty() && password != null && !password.isEmpty() ){
config = new ConnectionPoolConfigurationImpl( poolName )
.setPort( cassandraFig.getThriftPort() )
.setLocalDatacenter( cassandraFig.getLocalDataCenter() )
.setMaxConnsPerHost( poolSize )
.setSeeds( cassandraFig.getHosts() )
.setConnectTimeout( cassandraFig.getTimeout() )
.setSocketTimeout( cassandraFig.getTimeout() )
.setAuthenticationCredentials(new SimpleAuthenticationCredentials( username, password));
} else {
// create instance of the connection pool without credential if they are not set
config = new ConnectionPoolConfigurationImpl( poolName )
.setPort( cassandraFig.getThriftPort() )
.setLocalDatacenter( cassandraFig.getLocalDataCenter() )
.setMaxConnsPerHost( poolSize )
.setSeeds( cassandraFig.getHosts() )
.setSocketTimeout( cassandraFig.getTimeout() )
.setConnectTimeout( cassandraFig.getTimeout() );
}
return config;
}
示例6: getCluster
import com.netflix.astyanax.connectionpool.ConnectionPoolConfiguration; //导入依赖的package包/类
private AstyanaxContext<Cluster> getCluster ( final String clusterName,
final AstyanaxConfiguration astyanaxConfiguration,
final ConnectionPoolConfiguration poolConfig ) {
return new AstyanaxContext.Builder().forCluster( clusterName )
.withAstyanaxConfiguration( astyanaxConfiguration )
.withConnectionPoolConfiguration( poolConfig )
.withConnectionPoolMonitor( new Slf4jConnectionPoolMonitorImpl())
.buildCluster( ThriftFamilyFactory.getInstance() );
}
示例7: connectionPoolConfiguration
import com.netflix.astyanax.connectionpool.ConnectionPoolConfiguration; //导入依赖的package包/类
@Bean
@ConfigurationProperties("cassandra")
public ConnectionPoolConfiguration connectionPoolConfiguration(CassandraConfigurationProperties cassandraConfigurationProperties) {
return new ConnectionPoolConfigurationImpl("cpConfig").setSeeds(cassandraConfigurationProperties.getHost());
}
示例8: get
import com.netflix.astyanax.connectionpool.ConnectionPoolConfiguration; //导入依赖的package包/类
@Override
public ConnectionPoolConfiguration get(String name) {
return new ConnectionPoolConfigurationImpl(name);
}
示例9: get
import com.netflix.astyanax.connectionpool.ConnectionPoolConfiguration; //导入依赖的package包/类
public ConnectionPoolConfiguration get(String name);