C# Класс CqlSharp.Network.BalancedConnectionStrategy

This implementation attempts to balance the connections over the cluster based on load. First it will try to reuse an existing connection. If no connections exist, or if all connection loads are larger than the newConnectionTreshold, a new connection is created at a node with an as low as possible load. If that fails (e.g. because the max amount of connections per node is reached), an attempt is made to select the least used connection from the least used node.
Наследование: IConnectionStrategy
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
BalancedConnectionStrategy ( Ring nodes, CqlConnectionStringBuilder config ) : System.Linq

Initializes the strategy with the specified nodes and cluster configuration

GetOrCreateConnection ( ConnectionScope scope, PartitionKey partitionKey ) : Connection

Gets or creates connection to the cluster.

ReturnConnection ( Connection connection, ConnectionScope scope ) : void

Invoked when a connection is no longer in use by the application

Описание методов

BalancedConnectionStrategy() публичный Метод

Initializes the strategy with the specified nodes and cluster configuration
public BalancedConnectionStrategy ( Ring nodes, CqlConnectionStringBuilder config ) : System.Linq
nodes Ring The nodes.
config CqlConnectionStringBuilder The config.
Результат System.Linq

GetOrCreateConnection() публичный Метод

Gets or creates connection to the cluster.
public GetOrCreateConnection ( ConnectionScope scope, PartitionKey partitionKey ) : Connection
scope ConnectionScope
partitionKey PartitionKey
Результат Connection

ReturnConnection() публичный Метод

Invoked when a connection is no longer in use by the application
public ReturnConnection ( Connection connection, ConnectionScope scope ) : void
connection Connection The connection no longer used.
scope ConnectionScope
Результат void