feat: Add settings

This commit is contained in:
Braydon 2023-12-12 01:15:53 -05:00
parent 39a1a3983f
commit 0ed3f0e541
2 changed files with 17 additions and 1 deletions

@ -0,0 +1,16 @@
package me.braydon.feather;
import lombok.Getter;
import lombok.Setter;
/**
* Settings for feather, modify these as you wish!
*
* @author Braydon
*/
public final class FeatherSettings {
/**
* The amount of threads to use for {@link FeatherThreads}.
*/
@Setter @Getter private static int threadCount = 4;
}

@ -14,7 +14,7 @@ import java.util.concurrent.atomic.AtomicInteger;
*/ */
public final class FeatherThreads { public final class FeatherThreads {
private static final AtomicInteger ID = new AtomicInteger(0); // The thread id private static final AtomicInteger ID = new AtomicInteger(0); // The thread id
public static final ExecutorService THREAD_POOL = Executors.newFixedThreadPool(4, new ThreadFactoryBuilder() public static final ExecutorService THREAD_POOL = Executors.newFixedThreadPool(FeatherSettings.getThreadCount(), new ThreadFactoryBuilder()
.setNameFormat("Feather Thread #" + (ID.incrementAndGet())) .setNameFormat("Feather Thread #" + (ID.incrementAndGet()))
.build()); // The thread pool to execute on .build()); // The thread pool to execute on
} }