本文整理汇总了C#中HBaseClient.ExecuteAndGetWithVirtualNetworkLoadBalancing方法的典型用法代码示例。如果您正苦于以下问题:C# HBaseClient.ExecuteAndGetWithVirtualNetworkLoadBalancing方法的具体用法?C# HBaseClient.ExecuteAndGetWithVirtualNetworkLoadBalancing怎么用?C# HBaseClient.ExecuteAndGetWithVirtualNetworkLoadBalancing使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HBaseClient
的用法示例。
在下文中一共展示了HBaseClient.ExecuteAndGetWithVirtualNetworkLoadBalancing方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestLoadBalancerRetriesExhausted
public void TestLoadBalancerRetriesExhausted()
{
int numServers = 4;
int numFailures = 5;
var client = new HBaseClient(numServers);
int count = 0;
Func<string, Task<int>> f = (endpoint) =>
{
count++;
if (count < numFailures)
{
throw new TimeoutException(count.ToString());
}
return EmitIntAsync(count);
};
try
{
var output = client.ExecuteAndGetWithVirtualNetworkLoadBalancing(f);
}
catch (TimeoutException ex)
{
Assert.AreEqual(ex.Message, numServers.ToString());
return;
}
Assert.Fail();
}
示例2: TestExecuteAndGetWithVirtualNetworkLoadBalancing
public void TestExecuteAndGetWithVirtualNetworkLoadBalancing()
{
int numServers = 4;
int numFailures = 3;
var client = new HBaseClient(numServers);
int count = 0;
Func<string, Task<int>> f = (endpoint) =>
{
count++;
if (count < numFailures)
{
throw new TimeoutException();
}
return EmitIntAsync(count);
};
var output = client.ExecuteAndGetWithVirtualNetworkLoadBalancing<int>(f);
Assert.AreEqual(count, numFailures);
Assert.AreEqual(output, numFailures);
}
示例3: TestExecuteAndGetWithVirtualNetworkLoadBalancingTwoArgs
public void TestExecuteAndGetWithVirtualNetworkLoadBalancingTwoArgs()
{
int numServers = 4;
int numFailures = 3;
var client = new HBaseClient(numServers);
var arg1Value = "arg1";
var arg2Value = "arg2";
int count = 0;
Func<string, string, string, Task<int>> f = (arg1, arg2, endpoint) =>
{
Assert.AreEqual(arg1Value, arg1);
Assert.AreEqual(arg2Value, arg2);
count++;
if (count < numFailures)
{
throw new TimeoutException();
}
return EmitIntAsync(count);
};
var output = client.ExecuteAndGetWithVirtualNetworkLoadBalancing<string, string, int>(f, arg1Value, arg2Value);
Assert.AreEqual(count, numFailures);
Assert.AreEqual(output, numFailures);
}
示例4: TestLoadBalancerIgnoreBlackListedEndpoints
public void TestLoadBalancerIgnoreBlackListedEndpoints()
{
int numServers = 10;
int numBlackListedServers = 8;
var client = new HBaseClient(numServers);
var blackListedServers = BuildServersList(numBlackListedServers);
int result = 0;
int numFailures = 0;
Func<string, Task<int>> f = (endpoint) =>
{
var blacklistedEndpointFound = blackListedServers.Find(x => x.Equals(endpoint));
if (blacklistedEndpointFound != null)
{
numFailures++;
throw new TimeoutException();
}
result = 100;
return EmitIntAsync(result);
};
var resultInOutput = client.ExecuteAndGetWithVirtualNetworkLoadBalancing<int>(f);
Assert.IsTrue(resultInOutput == 100);
Assert.IsTrue(numFailures >= 0);
}