merlimat closed pull request #1242: Issue #1241: Fixed NPE in
PerChannelBookieClient
URL: https://github.com/apache/bookkeeper/pull/1242
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/PerChannelBookieClient.java
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/PerChannelBookieClient.java
index 5adc7cf5c..440239f19 100644
---
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/PerChannelBookieClient.java
+++
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/PerChannelBookieClient.java
@@ -876,17 +876,18 @@ private void writeAndFlush(final Channel channel,
try {
final long startTime = MathUtils.nowInNano();
ChannelFuture future = channel.writeAndFlush(request);
- future.addListener(new ChannelFutureListener() {
- @Override
- public void operationComplete(ChannelFuture future) throws
Exception {
- if (future.isSuccess()) {
-
nettyOpLogger.registerSuccessfulEvent(MathUtils.elapsedNanos(startTime),
- TimeUnit.NANOSECONDS);
- completionObjects.get(key).setOutstanding();
- } else {
-
nettyOpLogger.registerFailedEvent(MathUtils.elapsedNanos(startTime),
- TimeUnit.NANOSECONDS);
+ future.addListener(future1 -> {
+ if (future1.isSuccess()) {
+
nettyOpLogger.registerSuccessfulEvent(MathUtils.elapsedNanos(startTime),
+ TimeUnit.NANOSECONDS);
+ CompletionValue completion = completionObjects.get(key);
+ if (completion != null) {
+ completion.setOutstanding();
}
+
+ } else {
+
nettyOpLogger.registerFailedEvent(MathUtils.elapsedNanos(startTime),
+ TimeUnit.NANOSECONDS);
}
});
} catch (Throwable e) {
----------------------------------------------------------------
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