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

com.epam.deltix.thread.affinity.FixedAffinityLayout Maven / Gradle / Ivy

Go to download

A wrapper over net.openhft:affinity providing handy classes to create threads pinned to the specified CPUs.

The newest version!
package com.epam.deltix.thread.affinity;

import javax.annotation.Nonnull;
import java.util.BitSet;


public class FixedAffinityLayout implements AffinityLayout {

    protected final BitSet mask;

    public FixedAffinityLayout(@Nonnull final BitSet mask) {
        this.mask = mask;
    }

    public FixedAffinityLayout(final int... cpus) {
        final BitSet mask = new BitSet();

        for (int cpu : cpus) {
            mask.set(cpu);
        }

        this.mask = mask;
    }

    @Nonnull
    @Override
    public BitSet getMask(@Nonnull Thread thread) {
        return mask;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy