Exemplo n.º 1
0
        /**
         * Adds participant to distributed transaction
         */
        public void JoinTransaction(int txid, int serverId)
        {
            List<ParticipantProxy> participants;

            if (!_transactions.TryGetValue(txid, out participants))
            {
                participants = new List<ParticipantProxy>();
            }

            var participant = new ParticipantProxy(Config.GetServerUrl(serverId));
            participants.Add(participant);

            Console.WriteLine("Server {0} joined to transaction {1}", serverId, txid);
        }
Exemplo n.º 2
0
        private bool AbortTransactionForParticipant(int txid, ParticipantProxy participant)
        {
            IPartitipantProxy proxy = participant.GetProxy();

            try
            {
                proxy.AbortTransaction(txid);

                Console.WriteLine("{0} aborted transaction {1}", participant.Endpoint, txid);

                return true;
            }
            catch (TxException ex)
            {
                Console.WriteLine("{0} failed to abort transaction {1}", participant.Endpoint, txid);
                Console.WriteLine(ex.ToString());

                return false;
            }
        }