Exemplo n.º 1
0
        internal void Update(IRoutingTable newTable)
        {
            var added = newTable.All();

            added.ExceptWith(_routingTable.All());
            var removed = _routingTable.All();

            removed.ExceptWith(newTable.All());

            _poolManager.UpdateConnectionPool(added, removed);
            _routingTable = newTable;

            _logger?.Info("Updated routingTable to be {0}", _routingTable);
        }
Exemplo n.º 2
0
        private void ConsumeMessages(IResponsePipeline pipeline, int messages)
        {
            var leftMessages = messages;

            while (_bufferStream.Length > _bufferStream.Position && leftMessages > 0)
            {
                ProcessMessage(pipeline);

                leftMessages -= 1;
            }

            // Check whether we have incomplete message in the buffers
            if (_bufferStream.Length == _bufferStream.Position)
            {
                _bufferStream.SetLength(0);

                if (_bufferStream.Capacity > _maxBufferSize)
                {
                    _logger?.Info(
                        $@"Shrinking read buffers to the default read buffer size {
                                _defaultBufferSize
                            } since its size reached {
                                _bufferStream.Capacity
                            } which is larger than the maximum read buffer size {
                                _maxBufferSize
                            }. This has already occurred {_shrinkCounter} times for this connection.");

                    _shrinkCounter += 1;

                    _bufferStream.Capacity = _defaultBufferSize;
                }
            }
        }
Exemplo n.º 3
0
        internal async Task UpdateAsync(IRoutingTable newTable)
        {
            var added = newTable.All();

            added.ExceptWith(_routingTable.All());
            var removed = _routingTable.All();

            removed.ExceptWith(newTable.All());

            await _poolManager.UpdateConnectionPoolAsync(added, removed).ConfigureAwait(false);

            _routingTable = newTable;

            _logger?.Info("Updated routing table to be {0}", _routingTable);
        }
Exemplo n.º 4
0
        private void Cleanup()
        {
            _chunkStream.Position = 0;
            _chunkStream.SetLength(0);
            if (_chunkStream.Capacity > _maxBufferSize)
            {
                _logger?.Info(
                    $@"Shrinking write buffers to the default write buffer size {
                            _defaultBufferSize
                        } since its size reached {
                            _chunkStream.Capacity
                        } which is larger than the maximum write buffer size {
                            _maxBufferSize
                        }. This has already occurred {
                            _shrinkCounter
                        } times for this connection.");

                _shrinkCounter += 1;

                _chunkStream.Capacity = _defaultBufferSize;
            }
        }
Exemplo n.º 5
0
 public void Info(string message, params object[] args)
 {
     _delegate?.Info(Reformat(message), args);
 }
Exemplo n.º 6
0
 private void LogIllegalBookmark(string value)
 {
     _logger?.Info("Failed to recognize bookmark '{0}' and this bookmark is ignored.", value);
 }
Exemplo n.º 7
0
 public void OnConnectionError(Uri uri, Exception e)
 {
     _logger?.Info($"Server at {uri} is no longer available due to error: {e.Message}.");
     _routingTableManager.RoutingTable.Remove(uri);
     _clusterConnectionPool.Deactivate(uri);
 }