public override BoltConnection NewConnection(BoltChannel channel, BoltStateMachine stateMachine) { requireNonNull(channel); requireNonNull(stateMachine); BoltScheduler scheduler = _schedulerProvider.get(channel); BoltConnectionReadLimiter readLimiter = CreateReadLimiter(_config, _logService); BoltConnectionQueueMonitor connectionQueueMonitor = new BoltConnectionQueueMonitorAggregate(scheduler, readLimiter); ChunkedOutput chunkedOutput = new ChunkedOutput(channel.RawChannel(), _throttleGroup); BoltConnection connection; if (_monitors.hasListeners(typeof(BoltConnectionMetricsMonitor))) { connection = new MetricsReportingBoltConnection(channel, chunkedOutput, stateMachine, _logService, scheduler, connectionQueueMonitor, _metricsMonitor, _clock); } else { connection = new DefaultBoltConnection(channel, chunkedOutput, stateMachine, _logService, scheduler, connectionQueueMonitor); } connection.Start(); return(connection); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldDisableAndEnableAutoRead() public virtual void ShouldDisableAndEnableAutoRead() { int lowWatermark = 3; int highWatermark = 5; BoltConnectionReadLimiter limiter = NewLimiter(lowWatermark, highWatermark); assertTrue(_channel.config().AutoRead); for (int i = 0; i < highWatermark + 1; i++) { limiter.Enqueued(_connection, _job); } assertFalse(_channel.config().AutoRead); limiter.Drained(_connection, singleton(_job)); assertFalse(_channel.config().AutoRead); limiter.Drained(_connection, singleton(_job)); assertFalse(_channel.config().AutoRead); limiter.Drained(_connection, singleton(_job)); assertTrue(_channel.config().AutoRead); for (int i = 0; i < 3; i++) { limiter.Enqueued(_connection, _job); } assertFalse(_channel.config().AutoRead); limiter.Drained(_connection, Arrays.asList(_job, _job, _job, _job, _job, _job)); assertTrue(_channel.config().AutoRead); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldNotDisableAutoReadBelowHighWatermark() public virtual void ShouldNotDisableAutoReadBelowHighWatermark() { BoltConnectionReadLimiter limiter = NewLimiter(1, 2); assertTrue(_channel.config().AutoRead); limiter.Enqueued(_connection, _job); assertTrue(_channel.config().AutoRead); verify(_log, never()).warn(anyString(), any(), any()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldDisableAutoReadWhenAtHighWatermark() public virtual void ShouldDisableAutoReadWhenAtHighWatermark() { BoltConnectionReadLimiter limiter = NewLimiter(1, 2); assertTrue(_channel.config().AutoRead); limiter.Enqueued(_connection, _job); limiter.Enqueued(_connection, _job); limiter.Enqueued(_connection, _job); assertFalse(_channel.config().AutoRead); verify(_log).warn(contains("disabled"), eq(_channel.remoteAddress()), eq(3)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldEnableAutoReadOnlyOnceWhenBelowLowWatermark() public virtual void ShouldEnableAutoReadOnlyOnceWhenBelowLowWatermark() { BoltConnectionReadLimiter limiter = NewLimiter(1, 2); assertTrue(_channel.config().AutoRead); limiter.Enqueued(_connection, _job); limiter.Enqueued(_connection, _job); limiter.Enqueued(_connection, _job); limiter.Drained(_connection, Arrays.asList(_job, _job, _job)); assertTrue(_channel.config().AutoRead); verify(_log, times(1)).warn(contains("disabled"), eq(_channel.remoteAddress()), eq(3)); verify(_log, times(1)).warn(contains("enabled"), eq(_channel.remoteAddress()), eq(1)); }