当前位置: 首页>>代码示例>>Java>>正文


Java ConnectionPoolConfiguration类代码示例

本文整理汇总了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);
        }
    };
}
 
开发者ID:spinnaker,项目名称:kork,代码行数:17,代码来源:DefaultAstyanaxKeyspaceFactoryTest.java

示例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);
}
 
开发者ID:spinnaker,项目名称:kork,代码行数:9,代码来源:AstyanaxComponents.java

示例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));
}
 
开发者ID:spinnaker,项目名称:kork,代码行数:11,代码来源:DefaultAstyanaxKeyspaceFactory.java

示例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;
        }
    };
}
 
开发者ID:spinnaker,项目名称:kork,代码行数:28,代码来源:DefaultAstyanaxKeyspaceFactory.java

示例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;

    }
 
开发者ID:apache,项目名称:usergrid,代码行数:34,代码来源:CassandraClusterImpl.java

示例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() );

}
 
开发者ID:apache,项目名称:usergrid,代码行数:12,代码来源:CassandraClusterImpl.java

示例7: connectionPoolConfiguration

import com.netflix.astyanax.connectionpool.ConnectionPoolConfiguration; //导入依赖的package包/类
@Bean
@ConfigurationProperties("cassandra")
public ConnectionPoolConfiguration connectionPoolConfiguration(CassandraConfigurationProperties cassandraConfigurationProperties) {
    return new ConnectionPoolConfigurationImpl("cpConfig").setSeeds(cassandraConfigurationProperties.getHost());
}
 
开发者ID:spinnaker,项目名称:kork,代码行数:6,代码来源:AstyanaxComponents.java

示例8: get

import com.netflix.astyanax.connectionpool.ConnectionPoolConfiguration; //导入依赖的package包/类
@Override
public ConnectionPoolConfiguration get(String name) {
    return new ConnectionPoolConfigurationImpl(name);
}
 
开发者ID:Netflix,项目名称:staash,代码行数:5,代码来源:DefaultAstyanaxConnectionPoolConfigurationProvider.java

示例9: get

import com.netflix.astyanax.connectionpool.ConnectionPoolConfiguration; //导入依赖的package包/类
public ConnectionPoolConfiguration get(String name); 
开发者ID:Netflix,项目名称:staash,代码行数:2,代码来源:AstyanaxConnectionPoolConfigurationProvider.java


注:本文中的com.netflix.astyanax.connectionpool.ConnectionPoolConfiguration类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。