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

org.jctools.counters.CountersFactory Maven / Gradle / Ivy

There is a newer version: 1.52.1
Show newest version
package org.jctools.counters;

import org.jctools.util.UnsafeAccess;

/**
 * @author Tolstopyatov Vsevolod
 */
public final class CountersFactory {

    private CountersFactory() {
    }

    public static FixedSizeStripedLongCounter createFixedSizeStripedCounter(int stripesCount) {
        if (UnsafeAccess.SUPPORTS_GET_AND_ADD_LONG) {
            return new FixedSizeStripedLongCounterV8(stripesCount);
        } else {
            return new FixedSizeStripedLongCounterV6(stripesCount);
        }
    }

    public static FixedSizeStripedLongCounter createFixedSizeStripedCounterV6(int stripesCount) {
        return new FixedSizeStripedLongCounterV6(stripesCount);
    }

    public static FixedSizeStripedLongCounter createFixedSizeStripedCounterV8(int stripesCount) {
        return new FixedSizeStripedLongCounterV8(stripesCount);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy