wenbingshen commented on PR #3767:
URL: https://github.com/apache/bookkeeper/pull/3767#issuecomment-1429048456
> +0 to this change. it doesn't feel very necessary.
@Shoothzj Can you explain why it's not necessary? From the code,
numReadWorkerThreads covers negative values in other places where it is used
```java
private OrderedExecutor createExecutor(
int numThreads,
String nameFormat,
int maxTasksInQueue,
StatsLogger statsLogger) {
if (numThreads <= 0) {. <== here
return null;
} else {
return OrderedExecutor.newBuilder()
.numThreads(numThreads)
.name(nameFormat)
.traceTaskExecution(serverCfg.getEnableTaskExecutionStats())
.preserveMdcForTaskExecution(serverCfg.getPreserveMdcForTaskExecution())
.statsLogger(statsLogger)
.maxTasksInQueue(maxTasksInQueue)
.enableThreadScopedMetrics(true)
.build();
}
}
```
And here, an `IllegalArgumentException` will be thrown in `DirectEntryLogger`
```java
Cache<Integer, LogReader> cache = CacheBuilder.newBuilder()
.maximumWeight(perThreadBufferSize) <== here
.weigher((key, value) -> readBufferSize)
.removalListener(rl)
.expireAfterAccess(maxFdCacheTimeSeconds,
TimeUnit.SECONDS)
.concurrencyLevel(1) // important to avoid too
aggressive eviction
.build();
public CacheBuilder<K, V> maximumWeight(long maximumWeight) {
Preconditions.checkState(this.maximumWeight == -1L, "maximum weight
was already set to %s", this.maximumWeight);
Preconditions.checkState(this.maximumSize == -1L, "maximum size was
already set to %s", this.maximumSize);
Preconditions.checkArgument(maximumWeight >= 0L, "maximum weight
must not be negative"); <== here will throw IllegalArgumentException
this.maximumWeight = maximumWeight;
return this;
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]