// Path: core/src/main/java/com/github/phantomthief/pool/KeyAffinityExecutorUtils.java
// public static final int RANDOM_THRESHOLD = 20;
// 
// Path: core/src/main/java/com/github/phantomthief/util/ThrowableConsumer.java
// @FunctionalInterface
// public interface ThrowableConsumer<T, X extends Throwable> {
// 
//     void accept(T t) throws X;
// 
//     default ThrowableConsumer<T, X> andThen(ThrowableConsumer<? super T, X> after) {
//         requireNonNull(after);
//         return t -> {
//             accept(t);
//             after.accept(t);
//         };
//     }
// }


import static com.github.phantomthief.pool.KeyAffinityExecutorUtils.RANDOM_THRESHOLD;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.function.BooleanSupplier;
import java.util.function.IntPredicate;
import java.util.function.IntSupplier;
import java.util.function.Supplier;
import javax.annotation.CheckReturnValue;
import javax.annotation.Nonnegative;
import javax.annotation.Nonnull;
import javax.annotation.concurrent.NotThreadSafe;
import com.github.phantomthief.util.ThrowableConsumer;
import com.google.common.annotations.VisibleForTesting;
package com.github.phantomthief.pool.impl;





/**
 * @author w.vela
 * Created on 2018-02-09.
 */
@NotThreadSafe
class KeyAffinityBuilder<V> {

    private Supplier<V> factory;
    private IntSupplier count;
// Path: core/src/main/java/com/github/phantomthief/pool/KeyAffinityExecutorUtils.java
// public static final int RANDOM_THRESHOLD = 20;
// 
// Path: core/src/main/java/com/github/phantomthief/util/ThrowableConsumer.java
// @FunctionalInterface
// public interface ThrowableConsumer<T, X extends Throwable> {
// 
//     void accept(T t) throws X;
// 
//     default ThrowableConsumer<T, X> andThen(ThrowableConsumer<? super T, X> after) {
//         requireNonNull(after);
//         return t -> {
//             accept(t);
//             after.accept(t);
//         };
//     }
// }


// Path: core/src/main/java/com/github/phantomthief/pool/impl/KeyAffinityBuilder.java
import static com.github.phantomthief.pool.KeyAffinityExecutorUtils.RANDOM_THRESHOLD;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.function.BooleanSupplier;
import java.util.function.IntPredicate;
import java.util.function.IntSupplier;
import java.util.function.Supplier;
import javax.annotation.CheckReturnValue;
import javax.annotation.Nonnegative;
import javax.annotation.Nonnull;
import javax.annotation.concurrent.NotThreadSafe;
import com.github.phantomthief.util.ThrowableConsumer;
import com.google.common.annotations.VisibleForTesting;

package com.github.phantomthief.pool.impl;





/**
 * @author w.vela
 * Created on 2018-02-09.
 */
@NotThreadSafe
class KeyAffinityBuilder<V> {

    private Supplier<V> factory;
    private IntSupplier count;
    private ThrowableConsumer<V, Exception> depose;