sijie commented on a change in pull request #817: Client times out requests in
batch rather than individually
URL: https://github.com/apache/bookkeeper/pull/817#discussion_r155137716
##########
File path:
bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/BookieClient.java
##########
@@ -110,11 +119,29 @@ public BookieClient(ClientConfiguration conf,
EventLoopGroup eventLoopGroup,
this.statsLogger = statsLogger;
this.numConnectionsPerBookie = conf.getNumChannelsPerBookie();
- this.requestTimer = new HashedWheelTimer(
- new
ThreadFactoryBuilder().setNameFormat("BookieClientTimer-%d").build(),
- conf.getPCBCTimeoutTimerTickDurationMs(),
TimeUnit.MILLISECONDS,
- conf.getPCBCTimeoutTimerNumTicks());
this.bookieErrorThresholdPerInterval =
conf.getBookieErrorThresholdPerInterval();
+
+ this.scheduler = scheduler;
+ if (conf.getAddEntryTimeout() > 0 || conf.getReadEntryTimeout() > 0) {
+ SafeRunnable monitor = new SafeRunnable() {
+ @Override
+ public void safeRun() {
+ monitorPendingOperations();
+ }
+ };
+ this.timeoutFuture = this.scheduler.scheduleAtFixedRate(monitor,
+
conf.getTimeoutMonitorIntervalSec(),
+
conf.getTimeoutMonitorIntervalSec(),
+
TimeUnit.SECONDS);
+ }
+ }
+
+ public BookieClient(ClientConfiguration conf, EventLoopGroup
eventLoopGroup, OrderedSafeExecutor executor,
Review comment:
Can this constructor be package private and add `@VisibleForTesting`
annotation? I believe this constructor is only used for testing.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services