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


C# ClientConfig.SetNetworkConfig方法代码示例

本文整理汇总了C#中ClientConfig.SetNetworkConfig方法的典型用法代码示例。如果您正苦于以下问题:C# ClientConfig.SetNetworkConfig方法的具体用法?C# ClientConfig.SetNetworkConfig怎么用?C# ClientConfig.SetNetworkConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ClientConfig的用法示例。


在下文中一共展示了ClientConfig.SetNetworkConfig方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestConfig

        //[Test]
        public virtual void TestConfig()
        {
            var config = new ClientConfig();
            var networkConfig = new ClientNetworkConfig();
            networkConfig.SetAddresses(new[] { "127.0.0.1:5701" });
            config.SetNetworkConfig(networkConfig);
            config.SetGroupConfig(new GroupConfig("mike-local", "password"));
            var _client = HazelcastClient.NewHazelcastClient(config);

            Assert.NotNull(_client);

            _client.Shutdown();
        }
开发者ID:hasancelik,项目名称:hazelcast-csharp-client,代码行数:14,代码来源:ClientXmlTest.cs

示例2: Main111

        static void Main111(string[] args)
        {
            Environment.SetEnvironmentVariable("hazelcast.logging.type", "console");

            ClientConfig clientConfig = new ClientConfig();
            clientConfig.SetNetworkConfig(new ClientNetworkConfig().AddAddress(("127.0.0.1:5701")));
            IHazelcastInstance instance = HazelcastClient.NewHazelcastClient(clientConfig);

            var locker = instance.GetLock("processLock");
            Console.WriteLine("Waiting for lock");
            locker.Lock();
            Console.WriteLine("Locked");
            Console.ReadLine();
            locker.Unlock();

            instance.Shutdown();
        }
开发者ID:hasancelik,项目名称:hazelcast-csharp-client,代码行数:17,代码来源:QueueTest.cs

示例3: Main11

        private static void Main11(string[] args)
        {
            Environment.SetEnvironmentVariable("hazelcast.logging.class", "console");

            Console.WriteLine("INIT APP");
            ClientConfig clientConfig = new ClientConfig();
            clientConfig.SetNetworkConfig(new ClientNetworkConfig().AddAddress(("127.0.0.1:5701")));
            IHazelcastInstance client = HazelcastClient.NewHazelcastClient(clientConfig);
            var queue = client.GetQueue<byte[]>("a queue");

            var watch = Stopwatch.StartNew();
            var task = Task.Factory.StartNew(
                () =>
                {
                    byte[] loop = queue.Poll(15, TimeUnit.SECONDS);
                    while (loop != null && loop.Length != 0)
                    {
                        loop = queue.Poll(15,TimeUnit.SECONDS);
                        if (loop != null)
                        {
                            var a=new [] {loop[0], loop[1]};
                            Console.WriteLine(BitConverter.ToInt16(a,0));
                        }
                    }
                });

            const int byteLen = 1024 * 500;
            byte[] buf = new byte[byteLen];

            for (int i = 0; i < 1000; ++i)
            {
                byte[] bytes = BitConverter.GetBytes((short)i);
                Array.Copy(bytes,buf,bytes.Length);
                queue.Put(buf);
            }

            queue.Put(new byte[0]);

            task.Wait();
            var elapsed = watch.Elapsed;
            Console.WriteLine("Time: {0}", elapsed.TotalMilliseconds);

            client.Shutdown();
        }
开发者ID:hasancelik,项目名称:hazelcast-csharp-client,代码行数:44,代码来源:QueueTest.cs


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