protected void StopMemberAndWait(IHazelcastInstance client, RemoteController.Client remoteController, Cluster cluster, Member member) { var resetEvent = new ManualResetEventSlim(); var regId = client.GetCluster().AddMembershipListener(new MembershipListener { OnMemberRemoved = @event => resetEvent.Set() }); StopMember(remoteController, cluster, member); Assert.IsTrue(resetEvent.Wait(120 * 1000), "The member did not get removed in 120 seconds"); Assert.IsTrue(client.GetCluster().RemoveMembershipListener(regId)); }
protected Member StartMemberAndWait(IHazelcastInstance client, RemoteController.Client remoteController, Cluster cluster, int expectedSize) { var resetEvent = new ManualResetEventSlim(); var regId = client.GetCluster().AddMembershipListener(new MembershipListener { OnMemberAdded = @event => resetEvent.Set() }); var member = StartMember(remoteController, cluster); Assert.IsTrue(resetEvent.Wait(120 * 1000), "The member did not get added in 120 seconds"); Assert.IsTrue(client.GetCluster().RemoveMembershipListener(regId)); // make sure partitions are updated TestSupport.AssertTrueEventually( () => { Assert.AreEqual(expectedSize, GetUniquePartitionOwnerCount(client)); }, 60, "The partition list did not contain " + expectedSize + " partitions."); return(member); }
public static void StatDisplayTask() { while (true) { try { Thread.Sleep(STATS_SECONDS * 1000); Console.WriteLine("cluster size:" + hazelcast.GetCluster().GetMembers().Count); var currentStats = stats.GetAndReset(); Console.WriteLine(currentStats.ToString()); Console.WriteLine("Operations per Second : " + currentStats.Total() / STATS_SECONDS); } catch (Exception e) { Console.WriteLine(e.Message); } } }
protected void StopMemberAndWait(IHazelcastInstance client, RemoteController.Client remoteController, Cluster cluster, Member member) { var resetEvent = new ManualResetEventSlim(); var regId = client.GetCluster().AddMembershipListener(new MembershipListener { OnMemberRemoved = @event => resetEvent.Set() }); StopMember(remoteController, cluster, member); Assert.IsTrue(resetEvent.Wait(120*1000), "The member did not get removed in 120 seconds"); Assert.IsTrue(client.GetCluster().RemoveMembershipListener(regId)); }
protected Member StartMemberAndWait(IHazelcastInstance client, RemoteController.Client remoteController, Cluster cluster, int expectedSize) { var resetEvent = new ManualResetEventSlim(); var regId = client.GetCluster().AddMembershipListener(new MembershipListener { OnMemberAdded = @event => resetEvent.Set() }); var member = StartMember(remoteController, cluster); Assert.IsTrue(resetEvent.Wait(120*1000), "The member did not get added in 120 seconds"); Assert.IsTrue(client.GetCluster().RemoveMembershipListener(regId)); // make sure partitions are updated TestSupport.AssertTrueEventually( () => { Assert.AreEqual(expectedSize, GetUniquePartitionOwnerCount(client)); }, 60, "The partition list did not contain " + expectedSize + " partitions."); return member; }