ru.fix.aggregating.profiler.NoopProfiler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aggregating-profiler Show documentation
Show all versions of aggregating-profiler Show documentation
https://github.com/ru-fix/aggregating-profiler
package ru.fix.aggregating.profiler;
import java.util.concurrent.CompletableFuture;
import java.util.function.Supplier;
/**
* Test purpose stub
*/
public class NoopProfiler implements Profiler {
public static class NoopProfiledCall implements ProfiledCall {
@Override
public void call() {
}
@Override
public void call(long startTime) {
}
@Override
public void call(double payload) {
}
@Override
public void call(long startTime, double payload) {
}
@Override
public ProfiledCall start() {
return this;
}
@Override
public void stop(double payload) {
}
@Override
public void close() {
}
@Override
public void stop() {
}
@Override
public void stopIfRunning(double payload) {
}
@Override
public R profile(Supplier block) {
return block.get();
}
@Override
public void profile(Runnable block) {
block.run();
}
@Override
public R profileThrowable(ThrowableSupplier block) throws T {
return block.get();
}
@Override
public void profileThrowable(ThrowableRunnable block) throws T {
block.run();
}
@Override
public CompletableFuture profileFuture(Supplier> asyncInvocation) {
return asyncInvocation.get();
}
@Override
public CompletableFuture profileFutureThrowable(
ThrowableSupplier, T> asyncInvocation) throws T {
return asyncInvocation.get();
}
}
@Override
public ProfiledCall profiledCall(String name) {
return new NoopProfiledCall();
}
@Override
public ProfiledCall profiledCall(Identity identity) {
return new NoopProfiledCall();
}
@Override
public void attachIndicator(String name, IndicationProvider indicationProvider) {
}
@Override
public void detachIndicator(String name) {
}
public void setLabelSticker(LabelSticker labelSticker) {
//no need any changes
}
@Override
public ProfilerReporter createReporter() {
throw new UnsupportedOperationException();
}
@Override
public void attachIndicator(Identity identity, IndicationProvider indicationProvider) {
}
@Override
public void detachIndicator(Identity identity) {
}
}