コード例 #1
0
        public TccTransaction(TccTransactionData data, TccCoordinator <TContext> coordinator, TContext ctx)
        {
            // TODO: 从TransactionData中恢复数据
            _context = ctx.Deserialize <TContext>(data.ContextData);
            _txId    = data.TxId;
            _txState = data.TxState;

            _lock  = null;
            _works = new List <TccWorkUnit <TContext> >();
            _txCtx = null;

            _coordinator = coordinator;
            if (_coordinator != null)
            {
                _coordinator.NewTransaction(this);
                _tracing = _coordinator.Tracing;
            }
            else
            {
                _tracing = _defaultTracing;
            }

            Prepare();

            foreach (var a in _works)
            {
                a.Tracing = _tracing;
            }
        }
コード例 #2
0
        public TccTransaction(TContext ctx, TccCoordinator <TContext> coordinator)
        {
            _context = ctx;
            _txId    = Guid.NewGuid().ToString();
            _txState = TccTransactionState.New;

            _lock  = null;
            _works = new List <TccWorkUnit <TContext> >();
            _txCtx = null;

            Prepare();
            _coordinator = coordinator;
            if (_coordinator != null)
            {
                _coordinator.NewTransaction(this);
                _tracing = _coordinator.Tracing;
            }
            else
            {
                _tracing = _defaultTracing;
            }

            foreach (var a in _works)
            {
                a.Tracing = _tracing;
            }
        }
コード例 #3
0
 public TccCoordinatorService(TccCoordinator <TContext> coordinator)
 {
     _coordinator = coordinator;
 }