summaryrefslogtreecommitdiffstats
path: root/container-search/src/main/java/com/yahoo/search/dispatch/CloseableInvoker.java
diff options
context:
space:
mode:
Diffstat (limited to 'container-search/src/main/java/com/yahoo/search/dispatch/CloseableInvoker.java')
-rw-r--r--container-search/src/main/java/com/yahoo/search/dispatch/CloseableInvoker.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/container-search/src/main/java/com/yahoo/search/dispatch/CloseableInvoker.java b/container-search/src/main/java/com/yahoo/search/dispatch/CloseableInvoker.java
index 77496114df1..558b734be51 100644
--- a/container-search/src/main/java/com/yahoo/search/dispatch/CloseableInvoker.java
+++ b/container-search/src/main/java/com/yahoo/search/dispatch/CloseableInvoker.java
@@ -21,8 +21,11 @@ public abstract class CloseableInvoker implements Closeable {
private RequestDuration duration;
public void teardown(BiConsumer<Boolean, RequestDuration> teardown) {
- this.teardown = teardown;
- this.duration = new RequestDuration();
+ this.teardown = this.teardown == null ? teardown : (success, duration) -> {
+ this.teardown.accept(success, duration);
+ teardown.accept(success, duration);
+ };
+ this.duration = this.duration == null ? new RequestDuration() : this.duration;
}
protected void setFinalStatus(boolean success) {