Java源码示例:com.datastax.driver.core.NettyOptions
示例1
@Inject
public CQLSession(Configuration configuration)
{
inet = InetSocketAddress.createUnresolved(configuration.getCassandraHost(), configuration.getCassandraPort());
wlp = new WhiteListPolicy(new RoundRobinPolicy(), Collections.singletonList(inet));
this.nettyOptions = new NettyOptions();
this.queryOptions = new QueryOptions().setConsistencyLevel(ConsistencyLevel.ONE);
this.reconnectionPolicy = new ExponentialReconnectionPolicy(1000,
configuration.getHealthCheckFrequencyMillis());
}
示例2
@VisibleForTesting
CQLSession(InetSocketAddress target, NettyOptions options)
{
inet = target;
wlp = new WhiteListPolicy(new RoundRobinPolicy(), Collections.singletonList(inet));
this.nettyOptions = options;
this.queryOptions = new QueryOptions().setConsistencyLevel(ConsistencyLevel.ONE);
reconnectionPolicy = new ExponentialReconnectionPolicy(100, 1000);
}
示例3
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
fetchSize = (Integer)in.readObject();
readConsistency = (ConsistencyLevel)in.readObject();
writeConsistency = (ConsistencyLevel)in.readObject();
user = U.readString(in);
pwd = U.readString(in);
port = (Integer)in.readObject();
contactPoints = (List<InetAddress>)in.readObject();
contactPointsWithPorts = (List<InetSocketAddress>)in.readObject();
maxSchemaAgreementWaitSeconds = (Integer)in.readObject();
protoVer = (Integer)in.readObject();
compression = U.readString(in);
useSSL = (Boolean)in.readObject();
collectMetrix = (Boolean)in.readObject();
jmxReporting = (Boolean)in.readObject();
creds = (Credentials)in.readObject();
loadBalancingPlc = (LoadBalancingPolicy)readObject(in);
reconnectionPlc = (ReconnectionPolicy)readObject(in);
addrTranslator = (AddressTranslator)readObject(in);
speculativeExecutionPlc = (SpeculativeExecutionPolicy)readObject(in);
authProvider = (AuthProvider)readObject(in);
sslOptions = (SSLOptions)readObject(in);
poolingOptions = (PoolingOptions)readObject(in);
sockOptions = (SocketOptions)readObject(in);
nettyOptions = (NettyOptions)readObject(in);
}
示例4
public HealthCheck healthCheckFor(BoundNode node, NettyOptions shared)
{
CQLSession session = new CQLSession(node.inetSocketAddress(), shared);
sessions.add(session);
return new HealthCheck(session);
}
示例5
/**
* Sets netty options to use.
*
* @param options netty options.
*/
public void setNettyOptions(NettyOptions options) {
nettyOptions = options;
invalidate();
}
示例6
public NettyOptions getNettyOptions() {
return nettyOptions;
}
示例7
public void setNettyOptions(NettyOptions nettyOptions) {
this.nettyOptions = nettyOptions;
}