Skip to content

Commit 1624b8d

Browse files
authored
Add more logs in ListenableFutureUtil (linkedin#324)
* Add more logs in ListenableFuture
1 parent 4374a29 commit 1624b8d

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
v5.1.10
2+
------
3+
* Add more logging in ListenableFutureUtil to log root cause when ListeneableFuture is cancelled.
4+
15
v5.1.9
26
------
37
* Add logging in ListenableFutureUtil to log root cause when ListeneableFuture is cancelled.

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
version=5.1.9
1+
version=5.1.10
22
group=com.linkedin.parseq
33
org.gradle.parallel=true

subprojects/parseq-guava-interop/src/main/java/com/linkedin/parseq/guava/ListenableFutureUtil.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,18 @@ public static <T> Task<T> fromListenableFuture(ListenableFuture<T> future) {
4242
@Override
4343
public boolean cancel(Exception rootReason) {
4444
if (future.isCancelled()) {
45-
return super.cancel(rootReason);
45+
boolean taskCancelResult = super.cancel(rootReason);
46+
LOGGER.warn("Future is cancelled, therefore cancelling task, result: {}", taskCancelResult);
47+
return taskCancelResult;
4648
}
47-
LOGGER.warn("gRPC ListenableFuture is cancelled due to " + rootReason.getMessage(), rootReason);
48-
return super.cancel(rootReason) && future.cancel(true);
49+
boolean taskCancelResult = super.cancel(rootReason);
50+
boolean futureCancelResult = future.cancel(true);
51+
LOGGER.warn("gRPC ListenableFuture is cancelled due to {}, taskCancelResult: {}, futureCancelResult {}",
52+
rootReason.getMessage(),
53+
taskCancelResult,
54+
futureCancelResult,
55+
rootReason);
56+
return taskCancelResult && futureCancelResult;
4957
}
5058

5159
@Override

0 commit comments

Comments
 (0)