Spymemcached: Make abstract method in CompletionListener

This commit is contained in:
Nikolay Martynov 2018-06-14 09:21:57 -04:00
parent 30695555f9
commit 940633b388
2 changed files with 12 additions and 4 deletions

View File

@ -98,10 +98,8 @@ public abstract class CompletionListener<T> {
scope.close();
}
protected void processResult(Span span, T future)
throws ExecutionException, InterruptedException {
throw new UnsupportedOperationException("processResult was not implemented");
}
protected abstract void processResult(Span span, T future)
throws ExecutionException, InterruptedException;
protected void setResultTag(Span span, boolean hit) {
span.setTag(MEMCACHED_RESULT, hit ? HIT : MISS);

View File

@ -1,12 +1,22 @@
package datadog.trace.instrumentation.spymemcached;
import io.opentracing.Span;
import io.opentracing.Tracer;
import java.util.concurrent.ExecutionException;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class SyncCompletionListener extends CompletionListener<Void> {
public SyncCompletionListener(Tracer tracer, String methodName) {
super(tracer, methodName, false);
}
@Override
protected void processResult(Span span, Void future)
throws ExecutionException, InterruptedException {
log.error("processResult was called on SyncCompletionListener. This should never happen. ");
}
public void done(Throwable thrown) {
closeSyncSpan(thrown);
}