<commit_before>package edu.uw.zookeeper.netty.nio;

import java.util.concurrent.ThreadFactory;

import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import edu.uw.zookeeper.util.DefaultsFactory;

public enum NioEventLoopGroupFactory implements DefaultsFactory<ThreadFactory, EventLoopGroup> {

    DEFAULT(NioEventLoopGroup.DEFAULT_EVENT_LOOP_THREADS),
    AVAILABLE_PROCESSORS(Math.max(1, Runtime.getRuntime().availableProcessors()));
    
    private final int nthreads;
    private final int ioRatio = 75;
    
    private NioEventLoopGroupFactory(int nthreads) {
        this.nthreads = nthreads;
    }
    
    @Override
    public NioEventLoopGroup get() {
        NioEventLoopGroup instance = new NioEventLoopGroup(nthreads);
        instance.setIoRatio(ioRatio);
        return instance;
    }

    @Override
    public NioEventLoopGroup get(ThreadFactory value) {
        NioEventLoopGroup instance =  new NioEventLoopGroup(nthreads, value);<commit_msg>update for netty 4.0 CR9<commit_after>package edu.uw.zookeeper.netty.nio;

import java.util.concurrent.ThreadFactory;

import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import edu.uw.zookeeper.util.DefaultsFactory;

public enum NioEventLoopGroupFactory implements DefaultsFactory<ThreadFactory, EventLoopGroup> {

    DEFAULT(0),
    AVAILABLE_PROCESSORS(Math.max(1, Runtime.getRuntime().availableProcessors()));
    
    private final int nthreads;
    private final int ioRatio = 75;
    
    private NioEventLoopGroupFactory(int nthreads) {
        this.nthreads = nthreads;
    }
    
    @Override
    public NioEventLoopGroup get() {
        NioEventLoopGroup instance = new NioEventLoopGroup(nthreads);
        instance.setIoRatio(ioRatio);
        return instance;
    }

    @Override
    public NioEventLoopGroup get(ThreadFactory value) {
        NioEventLoopGroup instance =  new NioEventLoopGroup(nthreads, value);
{'fraction_non_alphanumeric': 0.08163265306122448, 'fraction_numerical': 0.00510204081632653, 'mean_word_length': 4.041131105398458, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2562609', 'n_tokens_mistral': 598, 'n_tokens_neox': 586, 'n_words': 111}