Package com.netflix.astyanax.impl

Examples of com.netflix.astyanax.impl.AstyanaxConfigurationImpl


  protected void createBestCassandraConfig(Map<String, Object> properties,
      String clusterName, String keyspace2, String seeds2) {
    Builder builder = new AstyanaxContext.Builder()
      .forCluster(clusterName)
      .forKeyspace(keyspace2)
      .withAstyanaxConfiguration(new AstyanaxConfigurationImpl()     
          .setDiscoveryType(NodeDiscoveryType.RING_DESCRIBE)
      )
      .withConnectionPoolConfiguration(new ConnectionPoolConfigurationImpl("MyConnectionPool")
          .setMaxConnsPerHost(20)
          .setInitConnsPerHost(2)
          .setSeeds(seeds2)
          .setConnectTimeout(10000)
      )
      .withConnectionPoolMonitor(new CountingConnectionPoolMonitor());
   
   
  if(seeds2.contains(",")) {
    //for a multi-node cluster, we want the test suite using quorum on writes and
    //reads so we have no issues...
    AstyanaxConfigurationImpl config = new AstyanaxConfigurationImpl();
    config.setDefaultWriteConsistencyLevel(ConsistencyLevel.CL_QUORUM);
    config.setDefaultReadConsistencyLevel(ConsistencyLevel.CL_QUORUM);
    builder = builder.withAstyanaxConfiguration(config);
  }
  properties.put(Bootstrap.CASSANDRA_BUILDER, builder);
  }
View Full Code Here


  protected void createBestCassandraConfig(Map<String, Object> properties,
      String clusterName, String keyspace2, String seeds2) {
    Builder builder = new AstyanaxContext.Builder()
      .forCluster(clusterName)
      .forKeyspace(keyspace2)
      .withAstyanaxConfiguration(new AstyanaxConfigurationImpl()     
          .setDiscoveryType(NodeDiscoveryType.RING_DESCRIBE)
      )
      .withConnectionPoolConfiguration(new ConnectionPoolConfigurationImpl("MyConnectionPool")
          .setMaxConnsPerHost(2)
          .setInitConnsPerHost(2)
          .setSeeds(seeds2)
      )
      .withConnectionPoolMonitor(new CountingConnectionPoolMonitor());
   
   
    if(!"localhost:9160".equals(seeds2)) {
      if(!seeds2.contains(","))
        throw new IllegalArgumentException("You must specify a comma delimited list of seeds OR 'localhost:9160' as the seed");
      //for a multi-node cluster, we want the test suite using quorum on writes and
      //reads so we have no issues...
      AstyanaxConfigurationImpl config = new AstyanaxConfigurationImpl();
      config.setDefaultWriteConsistencyLevel(ConsistencyLevel.CL_QUORUM);
      config.setDefaultReadConsistencyLevel(ConsistencyLevel.CL_QUORUM);
      builder = builder.withAstyanaxConfiguration(config);
    }   
    properties.put(Bootstrap.CASSANDRA_BUILDER, builder);
  }
View Full Code Here

  protected void createBestCassandraConfig(Map<String, Object> properties,
      String clusterName, String keyspace2, String seeds2) {
    Builder builder = new AstyanaxContext.Builder()
      .forCluster(clusterName)
      .forKeyspace(keyspace2)
      .withAstyanaxConfiguration(new AstyanaxConfigurationImpl()     
          .setDiscoveryType(NodeDiscoveryType.RING_DESCRIBE)
          .setConnectionPoolType(ConnectionPoolType.TOKEN_AWARE)
    .setClock(new MicrosecondsAsyncClock())
      )
      .withConnectionPoolConfiguration(new ConnectionPoolConfigurationImpl("MyConnectionPool")
          .setMaxConnsPerHost(20)
          .setInitConnsPerHost(2)
          .setSeeds(seeds2)
          .setConnectTimeout(10000)
    .setRetryBackoffStrategy(new FixedRetryBackoffStrategy(5000, 30000))
      )
      .withConnectionPoolMonitor(new CountingConnectionPoolMonitor());
   
   
  if(seeds2.contains(",")) {
    //for a multi-node cluster, we want the test suite using quorum on writes and
    //reads so we have no issues...
    AstyanaxConfigurationImpl config = new AstyanaxConfigurationImpl();
    config.setDefaultWriteConsistencyLevel(ConsistencyLevel.CL_QUORUM);
    config.setDefaultReadConsistencyLevel(ConsistencyLevel.CL_QUORUM);
    builder = builder.withAstyanaxConfiguration(config);
  }
  properties.put(Bootstrap.CASSANDRA_BUILDER, builder);
  }
View Full Code Here

     */
    private Keyspace createKeyspace() {
    try {
      AstyanaxContext<Keyspace> context = new AstyanaxContext.Builder()
              .forKeyspace(DynamicPropertyFactory.getInstance().getStringProperty(FluxConstants.CASSANDRA_KEYSPACE, "not-found-in-flux-configuration").get())
                .withAstyanaxConfiguration(new AstyanaxConfigurationImpl()
                    .setDiscoveryType(NodeDiscoveryType.RING_DESCRIBE)
                )
                .withConnectionPoolConfiguration(new ConnectionPoolConfigurationImpl("FluxCassandraConnectionPool")
                    .setPort(DynamicPropertyFactory.getInstance().getIntProperty(FluxConstants.CASSANDRA_PORT, Integer.MIN_VALUE).get())
                    .setMaxConnsPerHost(DynamicPropertyFactory.getInstance().getIntProperty(FluxConstants.CASSANDRA_MAXCONNSPERHOST, Integer.MIN_VALUE).get())
View Full Code Here

        try {
            setAstynaxConfiguration(ConfigurationManager.getConfigInstance());

            AstyanaxContext<Keyspace> context = new AstyanaxContext.Builder()
                    .forKeyspace(DynamicPropertyFactory.getInstance().getStringProperty(ZUUL_CASSANDRA_KEYSPACE, "zuul_scripts").get())
                    .withAstyanaxConfiguration(new AstyanaxConfigurationImpl()
                            .setDiscoveryType(NodeDiscoveryType.RING_DESCRIBE)
                    )
                    .withConnectionPoolConfiguration(new ConnectionPoolConfigurationImpl("cass_connection_pool")
                            .setPort(DynamicPropertyFactory.getInstance().getIntProperty(ZUUL_CASSANDRA_PORT, 7102).get())
                            .setMaxConnsPerHost(DynamicPropertyFactory.getInstance().getIntProperty(ZUUL_CASSANDRA_MAXCONNECTIONSPERHOST, 1).get())
View Full Code Here

  protected void createBestCassandraConfig(Map<String, Object> properties,
      String clusterName, String keyspace2, String seeds2) {
    Builder builder = new AstyanaxContext.Builder()
      .forCluster(clusterName)
      .forKeyspace(keyspace2)
      .withAstyanaxConfiguration(new AstyanaxConfigurationImpl()     
          .setDiscoveryType(NodeDiscoveryType.RING_DESCRIBE)
          .setConnectionPoolType(ConnectionPoolType.TOKEN_AWARE)
      )
      .withConnectionPoolConfiguration(new ConnectionPoolConfigurationImpl("MyConnectionPool")
          .setMaxConnsPerHost(20)
          .setInitConnsPerHost(2)
          .setSeeds(seeds2)
          .setConnectTimeout(10000)
      )
      .withConnectionPoolMonitor(new CountingConnectionPoolMonitor());
   
   
  if(seeds2.contains(",")) {
    //for a multi-node cluster, we want the test suite using quorum on writes and
    //reads so we have no issues...
    AstyanaxConfigurationImpl config = new AstyanaxConfigurationImpl();
    config.setDefaultWriteConsistencyLevel(ConsistencyLevel.CL_QUORUM);
    config.setDefaultReadConsistencyLevel(ConsistencyLevel.CL_QUORUM);
    builder = builder.withAstyanaxConfiguration(config);
  }
  properties.put(Bootstrap.CASSANDRA_BUILDER, builder);
  }
View Full Code Here

        .setSeeds(getSeeds());
  }
 
 
  protected AstyanaxConfiguration buildAstyanaxConfiguration() {
    return new AstyanaxConfigurationImpl()
        .setCqlVersion(getCqlVersion())
        .setTargetCassandraVersion(getTargetCassandraVersion())
        .setDiscoveryType(getNodeDiscoveryType());
        //.setDefaultReadConsistencyLevel(getDefaultReadConsistencyLevel())
        //.setDefaultWriteConsistencyLevel(getDefaultWriteConsistencyLevel());
View Full Code Here

            log.debug("Custom RetryBackoffStrategy {}", cpool.getRetryBackoffStrategy());
        } else {
            log.debug("Default RetryBackoffStrategy {}", cpool.getRetryBackoffStrategy());
        }

        AstyanaxConfigurationImpl aconf =
                new AstyanaxConfigurationImpl()
                        .setConnectionPoolType(poolType)
                        .setDiscoveryType(discType)
                        .setTargetCassandraVersion("1.2");

        if (0 < maxConnections) {
View Full Code Here

      }
   
      AstyanaxContext<Keyspace> context = new AstyanaxContext.Builder()
      .forCluster(CLUSTER_NAME)
      .forKeyspace(k)
      .withAstyanaxConfiguration(new AstyanaxConfigurationImpl() 
      .setDiscoveryType(NodeDiscoveryType.RING_DESCRIBE)
      .setConnectionPoolType(ConnectionPoolType.TOKEN_AWARE)
      .setDefaultReadConsistencyLevel(ConsistencyLevel.valueOf("CL_"+CMBProperties.getInstance().getReadConsistencyLevel()))
      .setDefaultWriteConsistencyLevel(ConsistencyLevel.valueOf("CL_"+CMBProperties.getInstance().getWriteConsistencyLevel())))
          .withConnectionPoolConfiguration(connectionPoolConfiguration)
View Full Code Here

                   .setPort(getPort())
                   .setMaxConnsPerHost(getConnectionsPerHost())
                   .setSeeds(getSeeds()))
               .withConnectionPoolMonitor(new Slf4jConnectionPoolMonitorImpl())
               .withAstyanaxConfiguration(
                   new AstyanaxConfigurationImpl()
                   .setCqlVersion(getCqlVersion())
                   .setTargetCassandraVersion(getTargetCassandraVersion())
             .setDiscoveryType(NodeDiscoveryType.NONE))
               .buildKeyspace(ThriftFamilyFactory.getInstance());
           context.start();
View Full Code Here

TOP

Related Classes of com.netflix.astyanax.impl.AstyanaxConfigurationImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.