本文整理汇总了C#中RequestHandler.GetNextConnection方法的典型用法代码示例。如果您正苦于以下问题:C# RequestHandler.GetNextConnection方法的具体用法?C# RequestHandler.GetNextConnection怎么用?C# RequestHandler.GetNextConnection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RequestHandler
的用法示例。
在下文中一共展示了RequestHandler.GetNextConnection方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetupEventListener
private void SetupEventListener()
{
var handler = new RequestHandler<RowSet>(_session, null, null);
var connection = handler.GetNextConnection(null);
_activeConnection.Value = connection;
_activeConnection.Value.CassandraEventResponse += conn_CassandraEvent;
var eventTypes = CassandraEventType.TopologyChange | CassandraEventType.StatusChange | CassandraEventType.SchemaChange;
var registerTask = _activeConnection.Value.Send(new RegisterForEventRequest(ControlConnectionProtocolVersion, eventTypes));
TaskHelper.WaitToComplete(registerTask, 10000);
if (!(registerTask.Result is ReadyResponse))
{
throw new DriverInternalError("Expected ReadyResponse, obtained " + registerTask.Result.GetType().Name);
}
}
示例2: Init
/// <summary>
/// Initialize the session
/// </summary>
internal void Init()
{
var handler = new RequestHandler<RowSet>(this, _serializer);
//Borrow a connection, trying to fail fast
TaskHelper.WaitToComplete(handler.GetNextConnection(new Dictionary<IPEndPoint,Exception>()));
}
示例3: Init
/// <summary>
/// Initialize the session
/// </summary>
/// <param name="createConnection">Determine if a connection must be created to test the host</param>
internal void Init(bool createConnection)
{
Policies.LoadBalancingPolicy.Initialize(Cluster);
if (!createConnection)
{
return;
}
var handler = new RequestHandler<RowSet>(this, null, null);
//Borrow a connection
handler.GetNextConnection(null);
}