当前位置: 首页>>代码示例>>C#>>正文


C# HBaseClient.ExecuteAndGetWithVirtualNetworkLoadBalancing方法代码示例

本文整理汇总了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();
        }
开发者ID:nayato,项目名称:hbase-sdk-for-net,代码行数:32,代码来源:VirtualNetworkLoadBalancerTests.cs

示例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);
        }
开发者ID:nayato,项目名称:hbase-sdk-for-net,代码行数:24,代码来源:VirtualNetworkLoadBalancerTests.cs

示例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);
        }
开发者ID:nayato,项目名称:hbase-sdk-for-net,代码行数:31,代码来源:VirtualNetworkLoadBalancerTests.cs

示例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);
        }
开发者ID:nayato,项目名称:hbase-sdk-for-net,代码行数:31,代码来源:VirtualNetworkLoadBalancerTests.cs


注:本文中的HBaseClient.ExecuteAndGetWithVirtualNetworkLoadBalancing方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。