Example #1
0
        public PushSubject(CancellationToken cancellationToken)
        {
#if ETL_DEBUG
            var msg = $"{_id}\t<{this.GetType().GetFullName()}>\tCreated";
            Console.WriteLine(msg);
            TmpClass.Log(msg);
#endif
            this.CancellationToken = cancellationToken;
            cancellationToken.Register(this.Complete);
        }
Example #2
0
        public void Complete()
        {
            lock (LockObject)
            {
                if (this._isComplete)
                {
                    return;
                }
#if ETL_DEBUG
                var msg = $"{_id}\t<{this.GetType().GetFullName()}>\tCompleted";
                Console.WriteLine(msg);
                TmpClass.Log(msg);
#endif
                this._isComplete = true;
                foreach (var item in this.Subscriptions.ToList())
                {
                    if (item.OnComplete != null)
                    {
                        item.OnComplete();
                    }
                }
            }
        }