Esempio n. 1
0
        public override void Close()
        {
            ExecuteIfNotClosed(() =>
            {
                // at this point Subscriber may be already terminated
                if (_isStageAlive)
                {
                    _sendToStage.WakeUp(InputStreamSinkStage.Close.Instance);
                }

                _isActive = false;
                return(NotUsed.Instance);
            });
        }
Esempio n. 2
0
        /// <summary>
        /// TBD
        /// </summary>
        /// <param name="disposing">TBD</param>
        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);
            ExecuteIfNotClosed(() =>
            {
                // at this point Subscriber may be already terminated
                if (_isStageAlive)
                {
                    _sendToStage.WakeUp(InputStreamSinkStage.Close.Instance);
                }

                _isActive = false;
                return(NotUsed.Instance);
            });
        }
 private void SendMessage(IAdapterToStageMessage msg, bool handleCancelled = true)
 {
     Send(() =>
     {
         _stageWithCallback.WakeUp(msg).Wait(_writeTimeout);
         if (_downstreamStatus.Value is Canceled && handleCancelled)
         {
             //Publisher considered to be terminated at earliest convenience to minimize messages sending back and forth
             _isPublisherAlive = false;
             throw PublisherClosedException;
         }
     });
 }