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

com.epam.deltix.thread.affinity.FallbackAffinityLayout 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 FallbackAffinityLayout implements AffinityLayout {

    protected final AffinityLayout layout;
    protected final BitSet fallback;

    public FallbackAffinityLayout(@Nonnull final AffinityLayout layout, @Nonnull final BitSet fallback) {
        this.layout = layout;
        this.fallback = fallback;
    }

    @Nonnull
    @Override
    public BitSet getMask(@Nonnull final Thread thread) {
        final BitSet mask = layout.getMask(thread);
        return mask.isEmpty() ? fallback : mask;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy