Exemple #1
0
        /// <inheritdoc />
        public async ValueTask DisposeAsync()
        {
            if (Interlocked.CompareExchange(ref _disposed, 1, 0) == 1)
            {
                return;
            }

            // order is important, must dispose the cluster last, as it will tear down
            // connections that may be required by other things being disposed

            try
            {
                if (_metricsPublisher != null)
                {
                    await _metricsPublisher.DisposeAsync().CfAwait();
                }
            }
            catch (Exception e)
            {
                _logger.LogError(e, "Caught exception while disposing the metrics publisher.");
            }

            try
            {
                await _nearCacheManager.DisposeAsync().CfAwait();
            }
            catch (Exception e)
            {
                _logger.LogError(e, "Caught exception while disposing the near cache manager.");
            }

            try
            {
                await _distributedOjects.DisposeAsync().CfAwait();
            }
            catch (Exception e)
            {
                _logger.LogError(e, "Caught exception while disposing the distributed object factory.");
            }

            try
            {
                await Cluster.DisposeAsync().CfAwait();
            }
            catch (Exception e)
            {
                _logger.LogError(e, "Caught exception while disposing the cluster.");
            }
        }
Exemple #2
0
        /// <inheritdoc />
        public async ValueTask DisposeAsync()
        {
            if (Interlocked.CompareExchange(ref _disposed, 1, 0) == 1)
            {
                return;
            }

            // order is important,
            // don't dispose the cluster before the rest!

            try
            {
                await _nearCacheManager.DisposeAsync().CAF();
            }
            catch (Exception e)
            {
                _logger.LogError(e, "Caught exception while disposing the near cache manager.");
            }

            try
            {
                await _distributedObjectFactory.DisposeAsync().CAF();
            }
            catch (Exception e)
            {
                _logger.LogError(e, "Caught exception while disposing the distributed object factory.");
            }

            try
            {
                await Cluster.DisposeAsync().CAF();
            }
            catch (Exception e)
            {
                _logger.LogError(e, "Caught exception while disposing the cluster.");
            }
        }