Java Code Examples for com.datastax.driver.core.SocketOptions#setTcpNoDelay()
The following examples show how to use
com.datastax.driver.core.SocketOptions#setTcpNoDelay() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CassandraSocketOptions.java From iotplatform with Apache License 2.0 | 6 votes |
@PostConstruct public void initOpts() { opts = new SocketOptions(); opts.setConnectTimeoutMillis(connectTimeoutMillis); opts.setReadTimeoutMillis(readTimeoutMillis); if (keepAlive != null) { opts.setKeepAlive(keepAlive); } if (reuseAddress != null) { opts.setReuseAddress(reuseAddress); } if (soLinger != null) { opts.setSoLinger(soLinger); } if (tcpNoDelay != null) { opts.setTcpNoDelay(tcpNoDelay); } if (receiveBufferSize != null) { opts.setReceiveBufferSize(receiveBufferSize); } if (sendBufferSize != null) { opts.setSendBufferSize(sendBufferSize); } }
Example 2
Source File: CassandraConfig.java From micro-integrator with Apache License 2.0 | 5 votes |
private Builder populateSocketOptions(Map<String, String> properties, Builder builder) throws DataServiceFault { String connectionTimeoutMillisProp = properties.get(DBConstants.Cassandra.CONNECTION_TIMEOUT_MILLIS); String keepAliveProp = properties.get(DBConstants.Cassandra.KEEP_ALIVE); String readTimeoutMillisProp = properties.get(DBConstants.Cassandra.READ_TIMEOUT_MILLIS); String receiveBufferSizeProp = properties.get(DBConstants.Cassandra.RECEIVER_BUFFER_SIZE); String reuseAddress = properties.get(DBConstants.Cassandra.REUSE_ADDRESS); String sendBufferSize = properties.get(DBConstants.Cassandra.SEND_BUFFER_SIZE); String soLinger = properties.get(DBConstants.Cassandra.SO_LINGER); String tcpNoDelay = properties.get(DBConstants.Cassandra.TCP_NODELAY); SocketOptions options = new SocketOptions(); if (connectionTimeoutMillisProp != null) { options.setConnectTimeoutMillis(Integer.parseInt(connectionTimeoutMillisProp)); } if (keepAliveProp != null) { options.setKeepAlive(Boolean.parseBoolean(keepAliveProp)); } if (readTimeoutMillisProp != null) { options.setReadTimeoutMillis(Integer.parseInt(readTimeoutMillisProp)); } if (receiveBufferSizeProp != null) { options.setReceiveBufferSize(Integer.parseInt(receiveBufferSizeProp)); } if (reuseAddress != null) { options.setReuseAddress(Boolean.parseBoolean(reuseAddress)); } if (sendBufferSize != null) { options.setSendBufferSize(Integer.parseInt(sendBufferSize)); } if (soLinger != null) { options.setSoLinger(Integer.parseInt(soLinger)); } if (tcpNoDelay != null) { options.setTcpNoDelay(Boolean.parseBoolean(tcpNoDelay)); } return builder.withSocketOptions(options); }
Example 3
Source File: CqlConfigHelper.java From stratio-cassandra with Apache License 2.0 | 5 votes |
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; }
Example 4
Source File: CassandraConfig.java From realtime-analytics with GNU General Public License v2.0 | 4 votes |
public Builder createBuilder() { Builder builder = Cluster.builder(); for (String address : contactPoints) { builder.addContactPoint(address); } builder.withCompression(compression); if (username != null && password != null) { builder.withCredentials(username, password); } if (reconnectionPolicy != null) { builder.withReconnectionPolicy(reconnectionPolicy); } if (retryPolicy != null) { builder.withRetryPolicy(retryPolicy); } builder.withPort(port); if (!jmxEnabled) { builder.withoutJMXReporting(); } if (!metricsEnabled) { builder.withoutMetrics(); } if (sslOptions != null) { builder.withSSL(sslOptions); } copyPoolingOptions(builder); SocketOptions opts = new SocketOptions(); opts.setConnectTimeoutMillis(connectTimeoutMillis); opts.setReadTimeoutMillis(readTimeoutMillis); if (receiveBufferSize != null) { opts.setReceiveBufferSize(receiveBufferSize); } if (sendBufferSize != null) { opts.setSendBufferSize(sendBufferSize); } if (soLinger != null) { opts.setSoLinger(soLinger); } if (keepAlive != null) { opts.setKeepAlive(keepAlive); } if (reuseAddress != null) { opts.setReuseAddress(reuseAddress); } if (tcpNoDelay != null) { opts.setTcpNoDelay(tcpNoDelay); } builder.withSocketOptions(opts); return builder; }