Package com.datastax.driver.core

Examples of com.datastax.driver.core.Configuration


        Object conn = ds.createPoolOrConnection();
        Cluster cluster = (Cluster) conn;

        HostDistance distance = HostDistance.LOCAL;

        Configuration configuration = cluster.getConfiguration();

        Assert.assertEquals(configuration.getSocketOptions().getReadTimeoutMillis(), 110000);
        Assert.assertEquals(configuration.getSocketOptions().getKeepAlive().booleanValue(), false);
        Assert.assertEquals(configuration.getSocketOptions().getReceiveBufferSize().intValue(), 12);
        Assert.assertEquals(configuration.getSocketOptions().getReuseAddress().booleanValue(), true);
        Assert.assertEquals(configuration.getSocketOptions().getSendBufferSize().intValue(), 11);
        Assert.assertEquals(configuration.getSocketOptions().getSoLinger().intValue(), 10);
        Assert.assertEquals(configuration.getSocketOptions().getTcpNoDelay().booleanValue(), true);

        Assert.assertEquals(configuration.getPoolingOptions().getCoreConnectionsPerHost(distance), 5);
        Assert.assertEquals(configuration.getPoolingOptions().getMaxConnectionsPerHost(distance), 12);
        Assert.assertEquals(configuration.getPoolingOptions()
                .getMaxSimultaneousRequestsPerConnectionThreshold(distance), 200);
        Assert.assertEquals(configuration.getPoolingOptions()
                .getMinSimultaneousRequestsPerConnectionThreshold(distance), 65);

        Assert.assertEquals(configuration.getPolicies().getLoadBalancingPolicy().getClass().getName(), RRP);
        Assert.assertEquals(configuration.getPolicies().getReconnectionPolicy().getClass().getName(), ERP);
        Assert.assertEquals(configuration.getPolicies().getRetryPolicy().getClass().getName(), DCRP);

        Assert.assertEquals(connectionProperties.getProperty("baseDelayMs"), "11000");
        Assert.assertEquals(connectionProperties.getProperty("maxDelayMs"), "13000");

        emf.close();
View Full Code Here


        Object conn = ds.createPoolOrConnection();
        Cluster cluster = (Cluster) conn;

        HostDistance distance = HostDistance.LOCAL;

        Configuration configuration = cluster.getConfiguration();

        Assert.assertEquals(configuration.getSocketOptions().getReadTimeoutMillis(), 110000);
        Assert.assertEquals(configuration.getSocketOptions().getKeepAlive().booleanValue(), false);
        Assert.assertEquals(configuration.getSocketOptions().getReceiveBufferSize().intValue(), 12);
        Assert.assertEquals(configuration.getSocketOptions().getReuseAddress().booleanValue(), true);
        Assert.assertEquals(configuration.getSocketOptions().getSendBufferSize().intValue(), 11);
        Assert.assertEquals(configuration.getSocketOptions().getSoLinger().intValue(), 10);
        Assert.assertEquals(configuration.getSocketOptions().getTcpNoDelay().booleanValue(), true);

        Assert.assertEquals(configuration.getPoolingOptions().getCoreConnectionsPerHost(distance), 5);
        Assert.assertEquals(configuration.getPoolingOptions().getMaxConnectionsPerHost(distance), 12);
        Assert.assertEquals(configuration.getPoolingOptions()
                .getMaxSimultaneousRequestsPerConnectionThreshold(distance), 200);
        Assert.assertEquals(configuration.getPoolingOptions()
                .getMinSimultaneousRequestsPerConnectionThreshold(distance), 65);
        Assert.assertEquals(configuration.getPolicies().getLoadBalancingPolicy().getClass().getName(), TAP);
        Assert.assertEquals(configuration.getPolicies().getReconnectionPolicy().getClass().getName(), CRP);
        Assert.assertEquals(configuration.getPolicies().getRetryPolicy().getClass().getName(), LRTP);

        Assert.assertEquals(connectionProperties.getProperty("constantDelayMs"), "110000");
        Assert.assertEquals(connectionProperties.getProperty("localdc"), "dc1");
        Assert.assertEquals(connectionProperties.getProperty("usedHostsPerRemoteDc"), "2");
        Assert.assertEquals(connectionProperties.getProperty("isTokenAware"), "true");
View Full Code Here

        Object conn = ds.createPoolOrConnection();
        Cluster cluster = (Cluster) conn;

        HostDistance distance = HostDistance.LOCAL;

        Configuration configuration = cluster.getConfiguration();

        Assert.assertEquals(configuration.getSocketOptions().getReadTimeoutMillis(), 110000);
        Assert.assertEquals(configuration.getSocketOptions().getKeepAlive().booleanValue(), false);
        Assert.assertEquals(configuration.getSocketOptions().getReceiveBufferSize().intValue(), 12);
        Assert.assertEquals(configuration.getSocketOptions().getReuseAddress().booleanValue(), true);
        Assert.assertEquals(configuration.getSocketOptions().getSendBufferSize().intValue(), 11);
        Assert.assertEquals(configuration.getSocketOptions().getSoLinger().intValue(), 10);
        Assert.assertEquals(configuration.getSocketOptions().getTcpNoDelay().booleanValue(), true);

        Assert.assertEquals(configuration.getPoolingOptions().getCoreConnectionsPerHost(distance), 5);
        Assert.assertEquals(configuration.getPoolingOptions().getMaxConnectionsPerHost(distance), 12);
        Assert.assertEquals(configuration.getPoolingOptions()
                .getMaxSimultaneousRequestsPerConnectionThreshold(distance), 200);
        Assert.assertEquals(configuration.getPoolingOptions()
                .getMinSimultaneousRequestsPerConnectionThreshold(distance), 65);
        Assert.assertEquals(configuration.getPolicies().getLoadBalancingPolicy().getClass().getName(),
                LatencyAwarePolicy.class.getName());
        Assert.assertEquals(configuration.getPolicies().getReconnectionPolicy().getClass().getName(), CRP);
        Assert.assertEquals(configuration.getPolicies().getRetryPolicy().getClass().getName(), LRTP);

        Assert.assertEquals(connectionProperties.getProperty("constantDelayMs"), "110000");
        Assert.assertEquals(connectionProperties.getProperty("localdc"), "dc1");
        Assert.assertEquals(connectionProperties.getProperty("usedHostsPerRemoteDc"), "2");
        Assert.assertEquals(connectionProperties.getProperty("isLatencyAware"), "true");
View Full Code Here

        Object conn = ds.createPoolOrConnection();
        Cluster cluster = (Cluster) conn;

        HostDistance distance = HostDistance.LOCAL;

        Configuration configuration = cluster.getConfiguration();

        Assert.assertEquals(configuration.getSocketOptions().getReadTimeoutMillis(), 110000);
        Assert.assertEquals(configuration.getSocketOptions().getKeepAlive().booleanValue(), false);
        Assert.assertEquals(configuration.getSocketOptions().getReceiveBufferSize().intValue(), 12);
        Assert.assertEquals(configuration.getSocketOptions().getReuseAddress().booleanValue(), true);
        Assert.assertEquals(configuration.getSocketOptions().getSendBufferSize().intValue(), 11);
        Assert.assertEquals(configuration.getSocketOptions().getSoLinger().intValue(), 10);
        Assert.assertEquals(configuration.getSocketOptions().getTcpNoDelay().booleanValue(), true);

        Assert.assertEquals(configuration.getPoolingOptions().getCoreConnectionsPerHost(distance), 5);
        Assert.assertEquals(configuration.getPoolingOptions().getMaxConnectionsPerHost(distance), 12);
        Assert.assertEquals(configuration.getPoolingOptions()
                .getMaxSimultaneousRequestsPerConnectionThreshold(distance), 200);
        Assert.assertEquals(configuration.getPoolingOptions()
                .getMinSimultaneousRequestsPerConnectionThreshold(distance), 65);

        Assert.assertEquals(configuration.getPolicies().getLoadBalancingPolicy().getClass().getName(), RRP);
        Assert.assertEquals(configuration.getPolicies().getReconnectionPolicy().getClass().getName(), ERP);
        Assert.assertEquals(configuration.getPolicies().getRetryPolicy().getClass().getName(), DCRP);

        Assert.assertEquals(connectionProperties.getProperty("baseDelayMs"), null);
        Assert.assertEquals(connectionProperties.getProperty("maxDelayMs"), null);
        emf.close();
View Full Code Here

        Object conn = ds.createPoolOrConnection();
        Cluster cluster = (Cluster) conn;

        HostDistance distance = HostDistance.LOCAL;

        Configuration configuration = cluster.getConfiguration();

        Assert.assertEquals(configuration.getSocketOptions().getReadTimeoutMillis(), 110000);
        Assert.assertEquals(configuration.getSocketOptions().getKeepAlive().booleanValue(), false);
        Assert.assertEquals(configuration.getSocketOptions().getReceiveBufferSize().intValue(), 12);
        Assert.assertEquals(configuration.getSocketOptions().getReuseAddress().booleanValue(), true);
        Assert.assertEquals(configuration.getSocketOptions().getSendBufferSize().intValue(), 11);
        Assert.assertEquals(configuration.getSocketOptions().getSoLinger().intValue(), 10);
        Assert.assertEquals(configuration.getSocketOptions().getTcpNoDelay().booleanValue(), true);

        Assert.assertEquals(configuration.getPoolingOptions().getCoreConnectionsPerHost(distance), 5);
        Assert.assertEquals(configuration.getPoolingOptions().getMaxConnectionsPerHost(distance), 12);
        Assert.assertEquals(configuration.getPoolingOptions()
                .getMaxSimultaneousRequestsPerConnectionThreshold(distance), 200);
        Assert.assertEquals(configuration.getPoolingOptions()
                .getMinSimultaneousRequestsPerConnectionThreshold(distance), 65);

        Assert.assertEquals(configuration.getPolicies().getLoadBalancingPolicy().getClass().getName(), DRRP);
        Assert.assertEquals(configuration.getPolicies().getReconnectionPolicy().getClass().getName(), CRP);
        Assert.assertEquals(configuration.getPolicies().getRetryPolicy().getClass().getName(), DCRP);

        Assert.assertEquals(connectionProperties.getProperty("constantDelayMs"), null);

        emf.close();
View Full Code Here

    this.cpConfig = cpConfig;
  }
 
  public Configuration getJDConfig() {
   
    return new Configuration(getPolicies(),
                 getProtocolOptions(),
                 getPoolingOptions(),
                 getSocketOptions(),
                 getMetricsOptions(),
                 getQueryOptions());
View Full Code Here

        }
        return null;
      }
    });
   
    Configuration config = javaDriverConfig;
   
    // We really need a mechanism to easily override Configuration on the builder
    Cluster.Builder builder = Cluster.builder()
        .addContactPoints(contactPoints.toArray(new String[0]))
        .withPort(port)
        .withLoadBalancingPolicy(config.getPolicies().getLoadBalancingPolicy())
        .withReconnectionPolicy(config.getPolicies().getReconnectionPolicy())
        .withRetryPolicy(config.getPolicies().getRetryPolicy())
        .withCompression(config.getProtocolOptions().getCompression())
        .withPoolingOptions(config.getPoolingOptions())
        .withSocketOptions(config.getSocketOptions())
        .withQueryOptions(config.getQueryOptions());
   
    if (config.getMetricsOptions() == null) {
      builder.withoutMetrics();
    } else if (!config.getMetricsOptions().isJMXReportingEnabled()) {
      builder.withoutJMXReporting();
    }
       
    this.cluster = builder.build();
    if (!(this.cpMonitor instanceof JavaDriverConnectionPoolMonitorImpl))
View Full Code Here

    PoolingOptions poolOptions = poolingOptions;
    SocketOptions sockOptions = socketOptions;
    MetricsOptions metricsOptions = new MetricsOptions(jmxReportingEnabled);
    QueryOptions qOptions = queryOptions;
   
    return new JavaDriverConnectionPoolConfigurationImpl(new Configuration(policies,
                           protocolOptions,
                           poolOptions,
                           sockOptions,
                           metricsOptions,
                           qOptions));
View Full Code Here

          }
          return null;
        }
      });

      Configuration config = javaDriverConfig;
     
      // We really need a mechanism to easily override Configuration on the builder
      Logger.info("Using port: " + port);
     
      Cluster.Builder builder = Cluster.builder()
          .addContactPoints(contactPoints.toArray(new String[0]))
          .withPort(port)
          .withLoadBalancingPolicy(config.getPolicies().getLoadBalancingPolicy())
          .withReconnectionPolicy(config.getPolicies().getReconnectionPolicy())
          .withRetryPolicy(config.getPolicies().getRetryPolicy())
          .withCompression(config.getProtocolOptions().getCompression())
          .withPoolingOptions(config.getPoolingOptions())
          .withSocketOptions(config.getSocketOptions())
          .withQueryOptions(config.getQueryOptions());
     
      if (config.getMetricsOptions() == null) {
        builder.withoutMetrics();
      } else if (!config.getMetricsOptions().isJMXReportingEnabled()) {
        builder.withoutJMXReporting();
      }
         
      cluster = builder.build();
      if (!(this.cpMonitor instanceof JavaDriverConnectionPoolMonitorImpl))
View Full Code Here

      }
      };
     
      ProtocolOptions protocolOptions = new ProtocolOptions(9042);
   
    Configuration jdConfig = new Configuration(new Policies(),
               protocolOptions,
               new PoolingOptions(),
               new SocketOptions(),
               new MetricsOptions(),
               new QueryOptions());
View Full Code Here

TOP

Related Classes of com.datastax.driver.core.Configuration

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.