Example #1
0
        internal virtual void ReleasePublication(Publication publication)
        {
            _clientLock.Lock();
            try
            {
                if (!publication.IsClosed)
                {
                    publication.InternalClose();

                    EnsureOpen();

                    var removedPublication = _resourceByRegIdMap[publication.RegistrationId];

                    if (_resourceByRegIdMap.Remove(publication.RegistrationId) && publication == removedPublication)
                    {
                        ReleaseLogBuffers(publication.LogBuffers(), publication.OriginalRegistrationId());
                        AwaitResponse(_driverProxy.RemovePublication(publication.RegistrationId));
                    }
                }
            }
            finally
            {
                _clientLock.Unlock();
            }
        }
Example #2
0
        internal void ReleasePublication(Publication publication)
        {
            _clientLock.Lock();
            try
            {
                if (_isTerminating || _isClosed)
                {
                    return;
                }

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

                    publication.InternalClose();

                    var removedPublication = _resourceByRegIdMap[publication.RegistrationId];

                    if (_resourceByRegIdMap.Remove(publication.RegistrationId) && publication == removedPublication)
                    {
                        ReleaseLogBuffers(publication.LogBuffers, publication.OriginalRegistrationId);
                        _asyncCommandIdSet.Add(_driverProxy.RemovePublication(publication.RegistrationId));
                    }
                }
            }
            finally
            {
                _clientLock.Unlock();
            }
        }