/// <summary> /// Creates a new <c>Policies</c> object using the provided policies. /// </summary> /// <param name="loadBalancingPolicy"> the load balancing policy to use. </param> /// <param name="reconnectionPolicy"> the reconnection policy to use. </param> /// <param name="retryPolicy"> the retry policy to use.</param> public Policies(ILoadBalancingPolicy loadBalancingPolicy, IReconnectionPolicy reconnectionPolicy, IRetryPolicy retryPolicy) : this(loadBalancingPolicy, reconnectionPolicy, retryPolicy, NoSpeculativeExecutionPolicy.Instance) { //Part of the public API can not be removed }
/// <summary> /// Creates a new <code>Policies</code> object using the provided policies. /// </summary> /// <param name="loadBalancingPolicy"> the load balancing policy to use. </param> /// <param name="reconnectionPolicy"> the reconnection policy to use. </param> /// <param name="retryPolicy"> the retry policy to use.</param> public Policies(ILoadBalancingPolicy loadBalancingPolicy, IReconnectionPolicy reconnectionPolicy, IRetryPolicy retryPolicy) { this._loadBalancingPolicy = loadBalancingPolicy; this._reconnectionPolicy = reconnectionPolicy; this._retryPolicy = retryPolicy; }
/// <summary> /// Creates a new <c>Policies</c> object using the provided policies. /// </summary> /// <param name="loadBalancingPolicy"> the load balancing policy to use. </param> /// <param name="reconnectionPolicy"> the reconnection policy to use. </param> /// <param name="retryPolicy"> the retry policy to use.</param> public Policies(ILoadBalancingPolicy loadBalancingPolicy, IReconnectionPolicy reconnectionPolicy, IRetryPolicy retryPolicy) { _loadBalancingPolicy = loadBalancingPolicy; _reconnectionPolicy = reconnectionPolicy; _retryPolicy = retryPolicy; }
/// <summary> /// Creates a new <c>Policies</c> object using the provided policies. /// </summary> /// <param name="loadBalancingPolicy"> the load balancing policy to use. </param> /// <param name="reconnectionPolicy"> the reconnection policy to use. </param> /// <param name="retryPolicy"> the retry policy to use.</param> public Policies(ILoadBalancingPolicy loadBalancingPolicy, IReconnectionPolicy reconnectionPolicy, IRetryPolicy retryPolicy) : this(loadBalancingPolicy, reconnectionPolicy, retryPolicy, DefaultSpeculativeExecutionPolicy, DefaultTimestampGenerator) { //Part of the public API can not be removed }
internal ControlConnection(byte initialProtocolVersion, Configuration config, Metadata metadata) { _metadata = metadata; _reconnectionPolicy = config.Policies.ReconnectionPolicy; _reconnectionSchedule = _reconnectionPolicy.NewSchedule(); _reconnectionTimer = new Timer(_ => Reconnect(), null, Timeout.Infinite, Timeout.Infinite); _config = config; ProtocolVersion = initialProtocolVersion; }
internal ControlConnection(ProtocolVersion initialProtocolVersion, Configuration config, Metadata metadata) { _metadata = metadata; _reconnectionPolicy = config.Policies.ReconnectionPolicy; _reconnectionSchedule = _reconnectionPolicy.NewSchedule(); _reconnectionTimer = new Timer(_ => Reconnect(), null, Timeout.Infinite, Timeout.Infinite); _config = config; _serializer = new Serializer(initialProtocolVersion, config.TypeSerializers); }
internal ControlConnection(byte initialProtocolVersion, Configuration config, Metadata metadata) { Metadata = metadata; _reconnectionPolicy = config.Policies.ReconnectionPolicy; _reconnectionSchedule = _reconnectionPolicy.NewSchedule(); _reconnectionTimer = new Timer(_ => Reconnect(), null, Timeout.Infinite, Timeout.Infinite); _config = config; ProtocolVersion = initialProtocolVersion; }
internal Policies(ILoadBalancingPolicy loadBalancingPolicy, IReconnectionPolicy reconnectionPolicy, IRetryPolicy retryPolicy, ISpeculativeExecutionPolicy speculativeExecutionPolicy) { _loadBalancingPolicy = loadBalancingPolicy; _reconnectionPolicy = reconnectionPolicy; _retryPolicy = retryPolicy; _speculativeExecutionPolicy = speculativeExecutionPolicy; }
internal Policies(ILoadBalancingPolicy loadBalancingPolicy, IReconnectionPolicy reconnectionPolicy, IRetryPolicy retryPolicy, ISpeculativeExecutionPolicy speculativeExecutionPolicy, ITimestampGenerator timestampGenerator) { _loadBalancingPolicy = loadBalancingPolicy ?? DefaultLoadBalancingPolicy; _reconnectionPolicy = reconnectionPolicy ?? DefaultReconnectionPolicy; _retryPolicy = retryPolicy ?? DefaultRetryPolicy; _speculativeExecutionPolicy = speculativeExecutionPolicy ?? DefaultSpeculativeExecutionPolicy; _timestampGenerator = timestampGenerator ?? DefaultTimestampGenerator; }
private Policies( ILoadBalancingPolicy loadBalancingPolicy, IReconnectionPolicy reconnectionPolicy, IRetryPolicy retryPolicy, ISpeculativeExecutionPolicy speculativeExecutionPolicy, ITimestampGenerator timestampGenerator, IExtendedRetryPolicy extendedRetryPolicy) { _loadBalancingPolicy = loadBalancingPolicy ?? throw new ArgumentNullException(nameof(loadBalancingPolicy)); _reconnectionPolicy = reconnectionPolicy ?? throw new ArgumentNullException(nameof(reconnectionPolicy)); _retryPolicy = retryPolicy ?? throw new ArgumentNullException(nameof(retryPolicy)); _speculativeExecutionPolicy = speculativeExecutionPolicy ?? throw new ArgumentNullException(nameof(speculativeExecutionPolicy)); _timestampGenerator = timestampGenerator ?? throw new ArgumentNullException(nameof(timestampGenerator)); _extendedRetryPolicy = extendedRetryPolicy ?? throw new ArgumentNullException(nameof(extendedRetryPolicy)); }
public void AddIfNotExistsOrBringUpIfDown(IPAddress ep, IReconnectionPolicy rp) { lock (_hosts) { if (!_hosts.ContainsKey(ep)) _hosts.Add(ep, new Host(ep, rp)); else _hosts[ep].BringUpIfDown(); } }
public RetryLoadBalancingPolicy(ILoadBalancingPolicy loadBalancingPolicy, IReconnectionPolicy reconnectionPolicy) { _reconnectionPolicy = reconnectionPolicy; _loadBalancingPolicy = loadBalancingPolicy; }
internal Metadata(IReconnectionPolicy rp) { this._hosts = new Hosts(rp); }
public Host AddHost(IPAddress address, IReconnectionPolicy rp) { _hosts.AddIfNotExistsOrBringUpIfDown(address, rp); return _hosts[address]; }
public Host(IPAddress address, IReconnectionPolicy reconnectionPolicy) { _address = address; _reconnectionPolicy = reconnectionPolicy; _reconnectionSchedule = reconnectionPolicy.NewSchedule(); }
private static Configuration GetConfig(int coreConnections = 3, int maxConnections = 8, IReconnectionPolicy rp = null) { var pooling = new PoolingOptions() .SetCoreConnectionsPerHost(HostDistance.Local, coreConnections) .SetMaxSimultaneousRequestsPerConnectionTreshold(HostDistance.Local, 1500) .SetMaxConnectionsPerHost(HostDistance.Local, maxConnections); var policies = new Policies(null, rp, null, null, null); var config = new Configuration( policies, new ProtocolOptions(), pooling, new SocketOptions(), new ClientOptions(), NoneAuthProvider.Instance, null, new QueryOptions(), new DefaultAddressTranslator()); return(config); }
public Host(IPAddress address, IReconnectionPolicy reconnectionPolicy) { this._address = address; this._reconnectionPolicy = reconnectionPolicy; this._reconnectionSchedule = reconnectionPolicy.NewSchedule(); }
private static Configuration GetConfig(int coreConnections = 3, int maxConnections = 8, IReconnectionPolicy rp = null) { var pooling = new PoolingOptions() .SetCoreConnectionsPerHost(HostDistance.Local, coreConnections) .SetMaxSimultaneousRequestsPerConnectionTreshold(HostDistance.Local, 1500) .SetMaxConnectionsPerHost(HostDistance.Local, maxConnections); var policies = new Policies( Policies.DefaultLoadBalancingPolicy, rp ?? Policies.DefaultReconnectionPolicy, Policies.DefaultRetryPolicy, Policies.DefaultSpeculativeExecutionPolicy); var config = new Configuration( policies, new ProtocolOptions(), pooling, new SocketOptions(), new ClientOptions(), NoneAuthProvider.Instance, null, new QueryOptions(), new DefaultAddressTranslator()); config.BufferPool = new Microsoft.IO.RecyclableMemoryStreamManager(); config.Timer = Timer; return(config); }
internal Metadata(IReconnectionPolicy rp) { Hosts = new Hosts(rp); Hosts.Down += OnHostDown; }
public Host(IPEndPoint address, IReconnectionPolicy reconnectionPolicy) { Address = address; _reconnectionPolicy = reconnectionPolicy; _reconnectionSchedule = reconnectionPolicy.NewSchedule(); }
public RoundRobinPolicyWithReconnectionRetries(IReconnectionPolicy reconnectionPolicy) { this._reconnectionPolicy = reconnectionPolicy; }
/// <summary> /// Configure the reconnection policy to use for the new cluster. <p> If no /// reconnection policy is set through this method, /// <link>Policies.DefaultReconnectionPolicy</link> will be used instead.</p> /// </summary> /// <param name="policy"> the reconnection policy to use </param> /// <returns>this Builder</returns> public new DseClusterBuilder WithReconnectionPolicy(IReconnectionPolicy policy) { base.WithReconnectionPolicy(policy); return(this); }
/// <summary> /// Configure the reconnection policy to use for the new cluster. <p> If no /// reconnection policy is set through this method, /// <link>Policies.DefaultReconnectionPolicy</link> will be used instead.</p> /// </summary> /// <param name="policy"> the reconnection policy to use </param> /// <returns>this Builder</returns> public new DseClusterBuilder WithReconnectionPolicy(IReconnectionPolicy policy) { base.WithReconnectionPolicy(policy); return this; }
/// <summary> /// Creates a new instance of <see cref="Host"/>. /// </summary> // ReSharper disable once UnusedParameter.Local : Part of the public API public Host(IPEndPoint address, IReconnectionPolicy reconnectionPolicy) : this(address, contactPoint : null) { }
public Hosts(IReconnectionPolicy rp) { this.rp = rp; }
private static Configuration GetConfig(int coreConnections = 3, int maxConnections = 8, IReconnectionPolicy rp = null) { var pooling = new PoolingOptions() .SetCoreConnectionsPerHost(HostDistance.Local, coreConnections) .SetMaxSimultaneousRequestsPerConnectionTreshold(HostDistance.Local, 1500) .SetMaxConnectionsPerHost(HostDistance.Local, maxConnections); var policies = new Policies(null, rp, null, null, null); var config = new Configuration( policies, new ProtocolOptions(), pooling, new SocketOptions(), new ClientOptions(), NoneAuthProvider.Instance, null, new QueryOptions(), new DefaultAddressTranslator(), Mock.Of <IStartupOptionsFactory>(), new SessionFactoryBuilder(), new Dictionary <string, IExecutionProfile>(), new RequestOptionsMapper(), null, null, null, null, null); return(config); }
private static Configuration GetConfig(int coreConnections = 3, int maxConnections = 8, IReconnectionPolicy rp = null) { var pooling = new PoolingOptions() .SetCoreConnectionsPerHost(HostDistance.Local, coreConnections) .SetMaxSimultaneousRequestsPerConnectionTreshold(HostDistance.Local, 1500) .SetMaxConnectionsPerHost(HostDistance.Local, maxConnections); var policies = new Cassandra.Policies(null, rp, null, null, null); var config = new TestConfigurationBuilder { Policies = policies, PoolingOptions = pooling }.Build(); return(config); }
public Hosts(IReconnectionPolicy rp) { _rp = rp; }
/// <summary> /// Creates a new instance of <see cref="Host"/>. /// </summary> // ReSharper disable once UnusedParameter.Local : Part of the public API public Host(IPEndPoint address, IReconnectionPolicy reconnectionPolicy) : this(address) { }
/// <summary> /// Configure the reconnection policy to use for the new cluster. <p> If no /// reconnection policy is set through this method, /// <link>Policies#DefaultReconnectionPolicy</link> will be used instead.</p> /// </summary> /// <param name="policy"> the reconnection policy to use </param> /// /// <returns>this Builder</returns> public Builder WithReconnectionPolicy(IReconnectionPolicy policy) { this._reconnectionPolicy = policy; return this; }
/// <summary> /// Configure the reconnection policy to use for the new cluster. <p> If no /// reconnection policy is set through this method, /// <link>Policies.DefaultReconnectionPolicy</link> will be used instead.</p> /// </summary> /// <param name="policy"> the reconnection policy to use </param> /// /// <returns>this Builder</returns> public Builder WithReconnectionPolicy(IReconnectionPolicy policy) { _reconnectionPolicy = policy; return(this); }