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

org.nohope.test.stress.MeasureProvider Maven / Gradle / Ivy

The newest version!
package org.nohope.test.stress;

import org.nohope.test.stress.functors.Get;
import org.nohope.test.stress.functors.Call;

import java.util.function.Function;

/**
 * @author Ketoth Xupack
 * @since 2013-12-29 18:23
 */
public final class MeasureProvider extends AbstractMeasureData {
    private final Function accumulatorLoader;

    MeasureProvider(final int threadId,
                    final int operationNumber,
                    final Function accumulatorLoader) {
        super(threadId, operationNumber);
        this.accumulatorLoader = accumulatorLoader;
    }

    @Override
    public  T get(final String name, final Get getter) throws Exception {
        return accumulatorLoader.apply(name).measure(getThreadId(), getter);
    }

    @Override
    public void call(final String name, final Call call) throws Exception {
        accumulatorLoader.apply(name).measure(getThreadId(), call);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy