All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ru.fix.aggregating.profiler.NoopProfiler Maven / Gradle / Ivy

There is a newer version: 1.6.6
Show newest version
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) {

    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy