Package com.datastax.driver.core

Examples of com.datastax.driver.core.SocketOptions


        return queryOptions;
    }

    private static SocketOptions getReadSocketOptions(Configuration conf)
    {
        SocketOptions socketOptions = new SocketOptions();
        Optional<Integer> connectTimeoutMillis = getInputNativeConnectionTimeout(conf);
        Optional<Integer> readTimeoutMillis = getInputNativeReadConnectionTimeout(conf);
        Optional<Integer> receiveBufferSize = getInputNativeReceiveBufferSize(conf);
        Optional<Integer> sendBufferSize = getInputNativeSendBufferSize(conf);
        Optional<Integer> soLinger = getInputNativeSolinger(conf);
        Optional<Boolean> tcpNoDelay = getInputNativeTcpNodelay(conf);
        Optional<Boolean> reuseAddress = getInputNativeReuseAddress(conf);      
        Optional<Boolean> keepAlive = getInputNativeKeepAlive(conf);

        if (connectTimeoutMillis.isPresent())
            socketOptions.setConnectTimeoutMillis(connectTimeoutMillis.get());
        if (readTimeoutMillis.isPresent())
            socketOptions.setReadTimeoutMillis(readTimeoutMillis.get());
        if (receiveBufferSize.isPresent())
            socketOptions.setReceiveBufferSize(receiveBufferSize.get());
        if (sendBufferSize.isPresent())
            socketOptions.setSendBufferSize(sendBufferSize.get());
        if (soLinger.isPresent())
            socketOptions.setSoLinger(soLinger.get());
        if (tcpNoDelay.isPresent())
            socketOptions.setTcpNoDelay(tcpNoDelay.get());
        if (reuseAddress.isPresent())
            socketOptions.setReuseAddress(reuseAddress.get());
        if (keepAlive.isPresent())
            socketOptions.setKeepAlive(keepAlive.get());    

        return socketOptions;
    }
View Full Code Here


    {
        int port = getInputNativePort(conf);
        Optional<AuthProvider> authProvider = getAuthProvider(conf);
        Optional<SSLOptions> sslOptions = getSSLOptions(conf);
        LoadBalancingPolicy loadBalancingPolicy = getReadLoadBalancingPolicy(conf, host);
        SocketOptions socketOptions = getReadSocketOptions(conf);
        QueryOptions queryOptions = getReadQueryOptions(conf);
        PoolingOptions poolingOptions = getReadPoolingOptions(conf);
       
        Cluster.Builder builder = Cluster.builder()
                                         .addContactPoint(host)
View Full Code Here

        return queryOptions;
    }

    private static SocketOptions getReadSocketOptions(Configuration conf)
    {
        SocketOptions socketOptions = new SocketOptions();
        Optional<Integer> connectTimeoutMillis = getInputNativeConnectionTimeout(conf);
        Optional<Integer> readTimeoutMillis = getInputNativeReadConnectionTimeout(conf);
        Optional<Integer> receiveBufferSize = getInputNativeReceiveBufferSize(conf);
        Optional<Integer> sendBufferSize = getInputNativeSendBufferSize(conf);
        Optional<Integer> soLinger = getInputNativeSolinger(conf);
        Optional<Boolean> tcpNoDelay = getInputNativeTcpNodelay(conf);
        Optional<Boolean> reuseAddress = getInputNativeReuseAddress(conf);      
        Optional<Boolean> keepAlive = getInputNativeKeepAlive(conf);

        if (connectTimeoutMillis.isPresent())
            socketOptions.setConnectTimeoutMillis(connectTimeoutMillis.get());
        if (readTimeoutMillis.isPresent())
            socketOptions.setReadTimeoutMillis(readTimeoutMillis.get());
        if (receiveBufferSize.isPresent())
            socketOptions.setReceiveBufferSize(receiveBufferSize.get());
        if (sendBufferSize.isPresent())
            socketOptions.setSendBufferSize(sendBufferSize.get());
        if (soLinger.isPresent())
            socketOptions.setSoLinger(soLinger.get());
        if (tcpNoDelay.isPresent())
            socketOptions.setTcpNoDelay(tcpNoDelay.get());
        if (reuseAddress.isPresent())
            socketOptions.setReuseAddress(reuseAddress.get());
        if (keepAlive.isPresent())
            socketOptions.setKeepAlive(keepAlive.get());    

        return socketOptions;
    }
View Full Code Here

  }

  @Override
  public void afterPropertiesSet() throws Exception {

    socketOptions = new SocketOptions();

    if (connectTimeoutMillis != null) {
      socketOptions.setConnectTimeoutMillis(connectTimeoutMillis);
    }
View Full Code Here

        clusterBuilder.addContactPoints(contactPoints.toArray(new String[contactPoints.size()]));

        clusterBuilder.withPort(config.getNativeProtocolPort());
        clusterBuilder.withReconnectionPolicy(new ExponentialReconnectionPolicy(500, 10000));

        SocketOptions socketOptions = new SocketOptions();
        socketOptions.setReadTimeoutMillis(config.getClientReadTimeout());
        socketOptions.setConnectTimeoutMillis(config.getClientConnectTimeout());
        if (config.getClientSoLinger() != null) {
            socketOptions.setSoLinger(config.getClientSoLinger());
        }
        clusterBuilder.withSocketOptions(socketOptions);

        if (config.getUsername() != null && config.getPassword() != null) {
            clusterBuilder.withCredentials(config.getUsername(), config.getPassword());
View Full Code Here

    {
        int port = getInputNativePort(conf);
        Optional<AuthProvider> authProvider = getAuthProvider(conf);
        Optional<SSLOptions> sslOptions = getSSLOptions(conf);
        LoadBalancingPolicy loadBalancingPolicy = getReadLoadBalancingPolicy(conf, host);
        SocketOptions socketOptions = getReadSocketOptions(conf);
        QueryOptions queryOptions = getReadQueryOptions(conf);
        PoolingOptions poolingOptions = getReadPoolingOptions(conf);
       
        Cluster.Builder builder = Cluster.builder()
                                         .addContactPoint(host)
View Full Code Here

        return queryOptions;
    }

    private static SocketOptions getReadSocketOptions(Configuration conf)
    {
        SocketOptions socketOptions = new SocketOptions();
        Optional<Integer> connectTimeoutMillis = getInputNativeConnectionTimeout(conf);
        Optional<Integer> readTimeoutMillis = getInputNativeReadConnectionTimeout(conf);
        Optional<Integer> receiveBufferSize = getInputNativeReceiveBufferSize(conf);
        Optional<Integer> sendBufferSize = getInputNativeSendBufferSize(conf);
        Optional<Integer> soLinger = getInputNativeSolinger(conf);
        Optional<Boolean> tcpNoDelay = getInputNativeTcpNodelay(conf);
        Optional<Boolean> reuseAddress = getInputNativeReuseAddress(conf);      
        Optional<Boolean> keepAlive = getInputNativeKeepAlive(conf);

        if (connectTimeoutMillis.isPresent())
            socketOptions.setConnectTimeoutMillis(connectTimeoutMillis.get());
        if (readTimeoutMillis.isPresent())
            socketOptions.setReadTimeoutMillis(readTimeoutMillis.get());
        if (receiveBufferSize.isPresent())
            socketOptions.setReceiveBufferSize(receiveBufferSize.get());
        if (sendBufferSize.isPresent())
            socketOptions.setSendBufferSize(sendBufferSize.get());
        if (soLinger.isPresent())
            socketOptions.setSoLinger(soLinger.get());
        if (tcpNoDelay.isPresent())
            socketOptions.setTcpNoDelay(tcpNoDelay.get());
        if (reuseAddress.isPresent())
            socketOptions.setReuseAddress(reuseAddress.get());
        if (keepAlive.isPresent())
            socketOptions.setKeepAlive(keepAlive.get());    

        return socketOptions;
    }
View Full Code Here

    }

    private SocketOptions getSocketOptions(Properties connectionProperties)
    {
        // SocketOptions
        SocketOptions socketConfig = new SocketOptions();

        String connectTimeoutMillis = connectionProperties.getProperty(CassandraConstants.SOCKET_TIMEOUT);
        String readTimeoutMillis = connectionProperties.getProperty("readTimeoutMillis");
        String keepAlive = connectionProperties.getProperty("keepAlive");
        String reuseAddress = connectionProperties.getProperty("reuseAddress");
        String soLinger = connectionProperties.getProperty("soLinger");
        String tcpNoDelay = connectionProperties.getProperty("tcpNoDelay");
        String receiveBufferSize = connectionProperties.getProperty("receiveBufferSize");
        String sendBufferSize = connectionProperties.getProperty("sendBufferSize");

        if (!StringUtils.isBlank(connectTimeoutMillis))
        {
            socketConfig.setConnectTimeoutMillis(new Integer(connectTimeoutMillis));
        }

        if (!StringUtils.isBlank(readTimeoutMillis))
        {
            socketConfig.setReadTimeoutMillis(new Integer(readTimeoutMillis));
        }

        if (!StringUtils.isBlank(keepAlive))
        {
            socketConfig.setKeepAlive(new Boolean(keepAlive));
        }

        if (!StringUtils.isBlank(reuseAddress))
        {
            socketConfig.setReuseAddress(new Boolean(reuseAddress));
        }

        if (!StringUtils.isBlank(soLinger))
        {
            socketConfig.setSoLinger(new Integer(soLinger));
        }

        if (!StringUtils.isBlank(tcpNoDelay))
        {
            socketConfig.setTcpNoDelay(new Boolean(tcpNoDelay));
        }

        if (!StringUtils.isBlank(receiveBufferSize))
        {
            socketConfig.setReceiveBufferSize(new Integer(receiveBufferSize));
        }

        if (!StringUtils.isBlank(sendBufferSize))
        {
            socketConfig.setSendBufferSize(new Integer(sendBufferSize));
        }

        return socketConfig;
    }
View Full Code Here

  public JavaDriverConnectionPoolConfigurationImpl build() {
   
    Policies policies = new Policies(loadBalancingPolicy, reconnectionPolicy, retryPolicy);
    ProtocolOptions protocolOptions = (nativeProtocolPort == -1) ? new ProtocolOptions() : new ProtocolOptions(nativeProtocolPort);
    PoolingOptions poolOptions = poolingOptions;
    SocketOptions sockOptions = socketOptions;
    MetricsOptions metricsOptions = new MetricsOptions(jmxReportingEnabled);
    QueryOptions qOptions = queryOptions;
   
    return new JavaDriverConnectionPoolConfigurationImpl(new Configuration(policies,
                           protocolOptions,
View Full Code Here

      ProtocolOptions protocolOptions = new ProtocolOptions(9042);
   
    Configuration jdConfig = new Configuration(new Policies(),
               protocolOptions,
               new PoolingOptions(),
               new SocketOptions(),
               new MetricsOptions(),
               new QueryOptions());

    AstyanaxContext<Keyspace> context = new AstyanaxContext.Builder()
    .forKeyspace(keyspaceName)
View Full Code Here

TOP

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

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.