Пример #1
0
        static void teste1()
        {
            bool res;

            DSTMLib.Init();

            res = DSTMLib.TxBegin();
            PADInt pi_a = DSTMLib.CreatePADInt(0);
            PADInt pi_b = DSTMLib.CreatePADInt(1);

            res = DSTMLib.TxCommit();

            res  = DSTMLib.TxBegin();
            pi_a = DSTMLib.AccessPADInt(0);
            pi_b = DSTMLib.AccessPADInt(1);
            pi_a.Write(36);
            pi_b.Write(37);
            Console.WriteLine("a = " + pi_a.Read());
            Console.WriteLine("b = " + pi_b.Read());
            DSTMLib.Status();
            // The following 3 lines assume we have 2 servers: one at port 2001 and another at port 2002
            res = DSTMLib.Freeze("tcp://localhost:2001/Server");
            res = DSTMLib.Recover("tcp://localhost:2001/Server");
            res = DSTMLib.Fail("tcp://localhost:2002/Server");
            res = DSTMLib.TxCommit();
            Console.WriteLine(res);
            Console.ReadLine();
        }
Пример #2
0
 public void Freeze(string URL)
 {
     try
     {
         DSTMLib.Freeze(URL);
         _logDelegate("Simulated Server freeze @ " + URL);
     }
     catch (TxException e)
     {
         _logDelegate(e.Message);
     }
 }