Package com.netflix.astyanax.impl

Examples of com.netflix.astyanax.impl.AstyanaxConfigurationImpl


    private static final Logger LOG = LoggerFactory.getLogger(AstyanaxUtil.class);
   
    public static Builder newBuilder(String hostString){
        return new AstyanaxContext.Builder()
        .forCluster("ClusterName")
        .withAstyanaxConfiguration(new AstyanaxConfigurationImpl().setDiscoveryType(NodeDiscoveryType.NONE))
        .withConnectionPoolConfiguration(
                new ConnectionPoolConfigurationImpl("MyConnectionPool").setPort(9160).setMaxConnsPerHost(1)
                        .setSeeds(hostString))
        .withConnectionPoolMonitor(new CountingConnectionPoolMonitor());
    }
View Full Code Here


                    .withCassandaConfigurationDirectoryPath(configurationPath)
                    .withCassandaYamlFile(cassandraYaml)
                    .build();
        }

        AstyanaxConfiguration configuration = new AstyanaxConfigurationImpl().setDiscoveryType(NodeDiscoveryType.NONE);

        ConnectionPoolConfiguration connectionPoolConfiguration = new ConnectionPoolConfigurationImpl("AstyanaxPool")
                .setPort(port)
                .setMaxConnsPerHost(1)
                .setSeeds(cassandraHostname + ":" + port);
View Full Code Here

            {
                File propFile = new File("cassandra.properties");
                if (propFile.exists())
                    config.load(new FileReader(propFile));

                AstyanaxConfigurationImpl configuration = new AstyanaxConfigurationImpl();
                configuration.setDiscoveryType(NodeDiscoveryType.valueOf(config.getProperty("astyanax.connection.discovery", "NONE")));
                configuration.setConnectionPoolType(ConnectionPoolType.valueOf(config.getProperty("astyanax.connection.pool", "ROUND_ROBIN")));
                configuration.setDefaultReadConsistencyLevel(ConsistencyLevel.valueOf(com.netflix.jmeter.properties.Properties.instance.cassandra.getReadConsistency()));
                configuration.setDefaultWriteConsistencyLevel(ConsistencyLevel.valueOf(com.netflix.jmeter.properties.Properties.instance.cassandra.getWriteConsistency()));

                logger.info("AstyanaxConfiguration: " + configuration.toString());

                String property = config.getProperty("astyanax.connection.latency.stategy", "EmptyLatencyScoreStrategyImpl");
                LatencyScoreStrategy latencyScoreStrategy = null;
                if (property.equalsIgnoreCase("SmaLatencyScoreStrategyImpl"))
                {
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

    }
   
    Builder builder = new AstyanaxContext.Builder()
      .forCluster(clusterName)
      .forKeyspace(keyspace2)
      .withAstyanaxConfiguration(new AstyanaxConfigurationImpl()     
          .setDiscoveryType(NodeDiscoveryType.RING_DESCRIBE)
          .setConnectionPoolType(ConnectionPoolType.TOKEN_AWARE)
    .setClock(new MicrosecondsAsyncClock())
      )
      .withConnectionPoolConfiguration(poolConfig)
      .withConnectionPoolMonitor(new CountingConnectionPoolMonitor());

    String clStr = (String) properties.get(Bootstrap.CASSANDRA_DEFAULT_CONSISTENCY_LEVEL);
    if(clStr != null) {
      ConsistencyLevel cl = null;
      for(ConsistencyLevel l : ConsistencyLevel.values()) {
        if(l.toString().equals(clStr)) {
          cl = l;
          break;
        }
      }
      if(cl == null)
        throw new IllegalArgumentException("Consistency level must be one of the strings mathcin astyanax ConsistencyLevel.XXXX");

      AstyanaxConfigurationImpl config = new AstyanaxConfigurationImpl();
      config.setDefaultWriteConsistencyLevel(cl);
      config.setDefaultReadConsistencyLevel(cl);
      builder = builder.withAstyanaxConfiguration(config);
    } else 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

                   .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

        String cassandraHost = System.getProperty( "cassandraHost", "localhost" );
        String cassandraPort = System.getProperty( "cassandraPort" );
        String cqlVersion = System.getProperty( "cassandra.cqlversion", "3.0.0" );
        keyspaceContext = new AstyanaxContext.Builder().forCluster( CLUSTER_NAME ).forKeyspace(
            KEYSPACE_NAME ).withAstyanaxConfiguration(
            new AstyanaxConfigurationImpl()
                //.setCqlVersion( cqlVersion )
                .setDiscoveryType( NodeDiscoveryType.RING_DESCRIBE )
                .setConnectionPoolType( ConnectionPoolType.TOKEN_AWARE ) )
            .withConnectionPoolConfiguration(
                new ConnectionPoolConfigurationImpl( CLUSTER_NAME + "_" + KEYSPACE_NAME )
View Full Code Here

  public CassandraStorage(CassandraDataSegmentConfig config)
  {
    this.astyanaxContext = new AstyanaxContext.Builder()
        .forCluster(CLUSTER_NAME)
        .forKeyspace(config.getKeyspace())
        .withAstyanaxConfiguration(new AstyanaxConfigurationImpl().setDiscoveryType(NodeDiscoveryType.NONE))
        .withConnectionPoolConfiguration(
            new ConnectionPoolConfigurationImpl("MyConnectionPool").setMaxConnsPerHost(10)
                .setSeeds(config.getHost())).withConnectionPoolMonitor(new CountingConnectionPoolMonitor())
        .buildKeyspace(ThriftFamilyFactory.getInstance());
    this.astyanaxContext.start();
View Full Code Here

  public void setup() {
    AstyanaxContext<Keyspace> context = new AstyanaxContext.Builder()
        .forCluster("Test Cluster")
        .forKeyspace(KS)
        .withAstyanaxConfiguration(
            new AstyanaxConfigurationImpl()
                .setDiscoveryType(NodeDiscoveryType.RING_DESCRIBE))
        .withConnectionPoolConfiguration(
            new ConnectionPoolConfigurationImpl("MyConnectionPool")
                .setPort(9160).setMaxConnsPerHost(1)
                .setSeeds("127.0.0.1:9160"))
View Full Code Here

    Keyspace provideKeyspace() {
         AstyanaxContext<Keyspace> keyspaceContext = new AstyanaxContext.Builder()
        .forCluster("test cluster")
        .forKeyspace(MetaConstants.META_KEY_SPACE)
        .withAstyanaxConfiguration(
                new AstyanaxConfigurationImpl()
                        .setDiscoveryType(
                                NodeDiscoveryType.NONE)
                        .setConnectionPoolType(
                                ConnectionPoolType.ROUND_ROBIN)
                        .setTargetCassandraVersion("1.2")
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.