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; } }
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; } }
public TccCoordinatorService(TccCoordinator <TContext> coordinator) { _coordinator = coordinator; }