mreutegg commented on code in PR #690:
URL: https://github.com/apache/jackrabbit-oak/pull/690#discussion_r983442704
##########
oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java:
##########
@@ -599,7 +599,7 @@ public DocumentNodeStore(DocumentNodeStoreBuilder<?>
builder) {
this.clusterId = clusterNodeInfo.getId();
if (isThrottlingEnabled(builder)) {
- s = new ThrottlingDocumentStoreWrapper(s);
+ s = new ThrottlingDocumentStoreWrapper(s,
builder.getThrottlingStatsCollector());
Review Comment:
The second parameter is annotated with `NotNull` but
`builder.getThrottlingStatsCollector()` can return null.
##########
oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreBuilder.java:
##########
@@ -145,6 +145,7 @@
private BlobStoreStats blobStoreStats;
private CacheStats blobStoreCacheStats;
private DocumentStoreStatsCollector documentStoreStatsCollector;
+ private ThrottlingStatsCollector throttlingStatsCollector;
Review Comment:
I would initialize this with a NOP ThrottlingStatsCollector to ensure this
is always non-null.
##########
oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreBuilder.java:
##########
@@ -526,6 +527,15 @@ public T
setDocumentStoreStatsCollector(DocumentStoreStatsCollector documentStor
return thisBuilder();
}
+ public ThrottlingStatsCollector getThrottlingStatsCollector() {
+ return throttlingStatsCollector;
+ }
+
+ public T setThrottlingStatsCollector(final ThrottlingStatsCollector
throttlingStatsCollector) {
+ this.throttlingStatsCollector = throttlingStatsCollector;
+ return thisBuilder();
+ }
Review Comment:
I would annotate the parameter with NotNull and then check this before
setting `this.throttlingStatsCollector`. Together with above suggested changes,
this ensures getThrottlingStatsCollector() always return a non-null value.
##########
oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreBuilder.java:
##########
@@ -526,6 +527,15 @@ public T
setDocumentStoreStatsCollector(DocumentStoreStatsCollector documentStor
return thisBuilder();
}
+ public ThrottlingStatsCollector getThrottlingStatsCollector() {
Review Comment:
Annotate with NotNull?
--
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]