package org.nohope.test.stress;

import org.nohope.test.stress.action.Get;
import org.nohope.test.stress.action.Invoke;

import java.util.concurrent.ConcurrentMap;

/**
 * @author <a href="mailto:ketoth.xupack@gmail.com">Ketoth Xupack</a>
 * @since 2013-12-29 18:23
 */
public final class MeasureProvider extends MeasureData {
    private final StressScenario scenario;
    private final ConcurrentMap<String, MultiInvocationStat> map;

    protected MeasureProvider(final StressScenario scenario,
                              final int threadId,
                              final int operationNumber,
                              final ConcurrentMap<String, MultiInvocationStat> map) {
        super(threadId, operationNumber);
        this.scenario = scenario;
        this.map = map;
    }

    protected <T> T invoke(final String name, final Get<T> getter) throws Exception {
        return getStat(name).invoke(getThreadId(), getter);
    }

    protected void invoke(final String name, final Invoke invoke) throws Exception {
        getStat(name).invoke(getThreadId(), invoke);
    }

    private MultiInvocationStat getStat(final String name) {
        map.putIfAbsent(name, new MultiInvocationStat(this.scenario.getResolution(), name));
        return map.get(name);
    }
}

@@ -796,24 +796,21 @@
 %7D%0A%0A    p
-rotected
+ublic
  %3CT%3E T i
@@ -946,24 +946,21 @@
 %7D%0A%0A    p
-rotected
+ublic
  void in

fix for api