C# 异步

        private void GetHttpResponse()
        {
            var client = new Microsoft.HBase.Client.HBaseClient(new ClusterCredentials(new Uri("https://cncloudhbjiaoyi.azurehdinsight.cn"), "admin", "Capitalandcs2016."));

            //定义扫描设定
            Scanner scannerSettings = new Scanner() { };
            //定义请求设定
            RequestOptions option = RequestOptions.GetDefaultOptions();
            

            var task = client.CreateScannerAsync("starinfocoupon", scannerSettings, option);
            task.ContinueWith(x => ShowResult(x.Result,client,option));
            
        }

        private void ShowResult(ScannerInformation result,HBaseClient client, RequestOptions option)
        {
            var scan = result;
            
            //扫描
            CellSet next = null;
            while ((next = client.ScannerGetNextAsync(scan, option).Result) != null)
            {
                foreach (CellSet.Row row in next.rows) { }
            }
        }

 

posted @ 2016-06-03 14:33  代码工人有力量  阅读(314)  评论(0编辑  收藏  举报