示例#1
0
        internal void ReleaseSubscription(Subscription subscription)
        {
            _clientLock.Lock();
            try
            {
                if (_isTerminating || _isClosed)
                {
                    return;
                }

                if (!subscription.IsClosed)
                {
                    EnsureNotReentrant();

                    subscription.InternalClose();

                    long registrationId = subscription.RegistrationId;
                    var  resource       = _resourceByRegIdMap[registrationId];
                    _resourceByRegIdMap.Remove(registrationId);

                    if (subscription == resource)
                    {
                        _asyncCommandIdSet.Add(_driverProxy.RemoveSubscription(registrationId));
                    }
                }
            }
            finally
            {
                _clientLock.Unlock();
            }
        }
示例#2
0
        internal virtual void ReleaseSubscription(Subscription subscription)
        {
            _clientLock.Lock();
            try
            {
                if (!subscription.Closed)
                {
                    subscription.InternalClose();

                    EnsureOpen();

                    long registrationId = subscription.RegistrationId;
                    AwaitResponse(_driverProxy.RemoveSubscription(registrationId));
                    _resourceByRegIdMap.Remove(registrationId);
                }
            }
            finally
            {
                _clientLock.Unlock();
            }
        }