本文整理汇总了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();
}
示例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();
}
示例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();
}