virajjasani commented on a change in pull request #2540:
URL: https://github.com/apache/hbase/pull/2540#discussion_r504416607
##########
File path:
hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
##########
@@ -1638,7 +1638,9 @@ private void stopChores() {
choreService.cancelChore(this.mobFileCleanerChore);
choreService.cancelChore(this.mobFileCompactionChore);
choreService.cancelChore(this.balancerChore);
-
choreService.cancelChore(getRegionNormalizerManager().getRegionNormalizerChore());
+ Optional.ofNullable(this.regionNormalizerManager)
Review comment:
Optional.ofNullable() is invoked twice, one here and another within
mapper:
```
public<U> Optional<U> map(Function<? super T, ? extends U> mapper) {
Objects.requireNonNull(mapper);
if (!isPresent())
return empty();
else {
return Optional.ofNullable(mapper.apply(value));
}
}
```
And ofNullable() itself is going to check if value is null, and accordingly
going to create new Optional object.
When we have direct Function to deal with, this approach would come with
minimal complexity. I am not saying here it is too complex, but compared to one
simple null check, yes it is bit complex :)
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]