Scalien.Users.IterateClients C# (CSharp) Method

IterateClients() public method

public IterateClients ( ) : bool
return bool
        public bool IterateClients()
        {
            if (clients.Count < ciinum + 1)
            {
                // TODO: force IterateClients usage
                ciinum = 0;
                return false;
            }

            client_index = ciinum;

            OpenDB();

            ciinum++;

            return true;
        }

Usage Example

コード例 #1
0
        //[TestMethod]
        public void MultiClusterTest_10_Threads()
        {
            int init_users = 10000;
            int threadnum = 10;

            Users usr = new Users(Utils.GetConfigNodes());
            // TODO add another client
            usr.EmptyAll();
            usr.InsertUsers(init_users);

            Thread[] threads = new Thread[threadnum];
            for (int i = 0; i < threadnum; i++)
            {
                threads[i] = new Thread(new ParameterizedThreadStart(MultiClusterTestWorker));
                threads[i].Start(500);
            }

            for (int i = 0; i < threadnum; i++)
            {
                threads[i].Join();
            }

            while(usr.IterateClients())
                Assert.IsTrue(usr.IsConsistent());

            Assert.IsTrue(usr.ClientDBsAreSame(0, 1));
        }