Package com.netflix.astyanax.connectionpool.impl

Examples of com.netflix.astyanax.connectionpool.impl.ConnectionPoolConfigurationImpl


      .forCluster(clusterName)
      .forKeyspace(keyspace2)
      .withAstyanaxConfiguration(new AstyanaxConfigurationImpl()     
          .setDiscoveryType(NodeDiscoveryType.RING_DESCRIBE)
      )
      .withConnectionPoolConfiguration(new ConnectionPoolConfigurationImpl("MyConnectionPool")
          .setMaxConnsPerHost(2)
          .setInitConnsPerHost(2)
          .setSeeds(seeds2)
      )
      .withConnectionPoolMonitor(new CountingConnectionPoolMonitor());
View Full Code Here


  }
 
  @Override
  protected void createBestCassandraConfig(Map<String, Object> properties,
      String clusterName, String keyspace2, String seeds2) {
    ConnectionPoolConfigurationImpl poolConfig = new ConnectionPoolConfigurationImpl("MyConnectionPool")
        .setMaxConnsPerHost(20)
        .setInitConnsPerHost(2)
        .setSeeds(seeds2)
        .setConnectTimeout(10000)
        .setRetryBackoffStrategy(new FixedRetryBackoffStrategy(5000, 30000));

    Object port = properties.get(Bootstrap.CASSANDRA_THRIFT_PORT);
    if(port != null) {
      int portVal = 9160;
      if(port instanceof Integer)
        portVal = (Integer) port;
      else if(port instanceof String)
        portVal = Integer.valueOf((String) port);
      else
        throw new RuntimeException(Bootstrap.CASSANDRA_THRIFT_PORT+" key in map has a value of type="+port.getClass()+" but that must be a String or Integer");
      poolConfig.setPort(portVal);
    }
   
    Builder builder = new AstyanaxContext.Builder()
      .forCluster(clusterName)
      .forKeyspace(keyspace2)
View Full Code Here

      .forCluster(clusterName)
      .forKeyspace(keyspace2)
      .withAstyanaxConfiguration(new AstyanaxConfigurationImpl()     
          .setDiscoveryType(NodeDiscoveryType.RING_DESCRIBE)
      )
      .withConnectionPoolConfiguration(new ConnectionPoolConfigurationImpl("MyConnectionPool")
          .setMaxConnsPerHost(20)
          .setInitConnsPerHost(2)
          .setSeeds(seeds2)
          .setConnectTimeout(10000)
      )
View Full Code Here

      .forCluster(clusterName)
      .forKeyspace(keyspace2)
      .withAstyanaxConfiguration(new AstyanaxConfigurationImpl()     
          .setDiscoveryType(NodeDiscoveryType.RING_DESCRIBE)
      )
      .withConnectionPoolConfiguration(new ConnectionPoolConfigurationImpl("MyConnectionPool")
          .setMaxConnsPerHost(2)
          .setInitConnsPerHost(2)
          .setSeeds(seeds2)
      )
      .withConnectionPoolMonitor(new CountingConnectionPoolMonitor());
View Full Code Here

      .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))
View Full Code Here

      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())
                    .setSeeds(DynamicPropertyFactory.getInstance().getStringProperty(FluxConstants.CASSANDRA_HOST, "not-found-in-flux-configuration").get() + ":" +
                        DynamicPropertyFactory.getInstance().getIntProperty(FluxConstants.CASSANDRA_PORT, Integer.MIN_VALUE).get()
                    )
View Full Code Here

            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())
                            .setSeeds(DynamicPropertyFactory.getInstance().getStringProperty(ZUUL_CASSANDRA_HOST, "").get() + ":" +
                                    DynamicPropertyFactory.getInstance().getIntProperty(ZUUL_CASSANDRA_PORT, 7102).get()
                            )
View Full Code Here

      .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)
      )
View Full Code Here

  }

 
 
  protected ConnectionPoolConfiguration buildConnectionPoolConfiguration() {
    return new ConnectionPoolConfigurationImpl(getConnectionPoolName())
        .setPort(getPort())
        .setMaxConnsPerHost(getConnectionsPerHost())
        .setSeeds(getSeeds());
  }
View Full Code Here

    String username = CMBProperties.getInstance().getCassandraUsername();
    String password = CMBProperties.getInstance().getCassandraPassword();   
   
    for (String k : keyspaceNames) {

      ConnectionPoolConfigurationImpl connectionPoolConfiguration = new ConnectionPoolConfigurationImpl("CMBAstyananxConnectionPool")
      .setMaxConnsPerHost(CMBProperties.getInstance().getAstyanaxMaxConnectionsPerNode())
      .setSocketTimeout(CMBProperties.getInstance().getCassandraThriftSocketTimeOutMS())
      .setConnectTimeout(CMBProperties.getInstance().getAstyanaxConnectionWaitTimeOutMS())
      .setSeeds(AbstractDurablePersistence.CLUSTER_URL);
     
      if (username != null && password != null) {
        connectionPoolConfiguration.setAuthenticationCredentials(new SimpleAuthenticationCredentials(username, password));
      }

      if (dataCenter != null && !dataCenter.equals("")) {
        connectionPoolConfiguration.setLocalDatacenter(dataCenter);
      }
   
      AstyanaxContext<Keyspace> context = new AstyanaxContext.Builder()
      .forCluster(CLUSTER_NAME)
      .forKeyspace(k)
View Full Code Here

TOP

Related Classes of com.netflix.astyanax.connectionpool.impl.ConnectionPoolConfigurationImpl

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.