Make ARW to record class

This commit is contained in:
2026-08-17 13:59:46 +08:00
parent 1192f2e674
commit 9eb5c767ed
2 changed files with 9 additions and 14 deletions
@@ -96,22 +96,22 @@ public class CpuAffinityConfig implements IConfigModule {
if (enabledForTickRegion) { if (enabledForTickRegion) {
tickRegionRunnableWrapper = new AffinityRunnableWrapper("tick_region", parseAffinity(tickRegionAffinity)); tickRegionRunnableWrapper = new AffinityRunnableWrapper("tick_region", parseAffinity(tickRegionAffinity));
LOGGER.info("Tick region thread now bound to: {}", tickRegionRunnableWrapper.getAffinity()); LOGGER.info("Tick region thread now bound to: {}", tickRegionRunnableWrapper.affinity());
} }
if (enabledForChunkSystemIo) { if (enabledForChunkSystemIo) {
chunkSystemIoRunnableWrapper = new AffinityRunnableWrapper("chunk_system_io", parseAffinity(chunkSystemIoAffinity)); chunkSystemIoRunnableWrapper = new AffinityRunnableWrapper("chunk_system_io", parseAffinity(chunkSystemIoAffinity));
LOGGER.info("Chunk system I/O thread now bound to: {}", chunkSystemIoRunnableWrapper.getAffinity()); LOGGER.info("Chunk system I/O thread now bound to: {}", chunkSystemIoRunnableWrapper.affinity());
} }
if (enabledForChunkSystemWorker) { if (enabledForChunkSystemWorker) {
chunkSystemWorkerRunnableWrapper = new AffinityRunnableWrapper("chunk_system_worker", parseAffinity(chunkSystemWorkerAffinity)); chunkSystemWorkerRunnableWrapper = new AffinityRunnableWrapper("chunk_system_worker", parseAffinity(chunkSystemWorkerAffinity));
LOGGER.info("Chunk system worker thread now bound to: {}", chunkSystemWorkerRunnableWrapper.getAffinity()); LOGGER.info("Chunk system worker thread now bound to: {}", chunkSystemWorkerRunnableWrapper.affinity());
} }
if (enableForNettyIo) { if (enableForNettyIo) {
nettyIoRunnableWrapper = new AffinityRunnableWrapper("netty_io", parseAffinity(nettyIoAffinity)); nettyIoRunnableWrapper = new AffinityRunnableWrapper("netty_io", parseAffinity(nettyIoAffinity));
LOGGER.info("Netty I/O thread now bound to: {}", nettyIoRunnableWrapper.getAffinity()); LOGGER.info("Netty I/O thread now bound to: {}", nettyIoRunnableWrapper.affinity());
} }
} }
@@ -5,14 +5,7 @@ import org.jetbrains.annotations.NotNull;
import java.util.BitSet; import java.util.BitSet;
public class AffinityRunnableWrapper { public record AffinityRunnableWrapper(String name, BitSet affinity) {
private final BitSet affinity;
private final String name;
public AffinityRunnableWrapper(String name, BitSet affinity) {
this.name = name;
this.affinity = affinity;
}
public Runnable wrap(Runnable original) { public Runnable wrap(Runnable original) {
return () -> { return () -> {
@@ -22,13 +15,15 @@ public class AffinityRunnableWrapper {
}; };
} }
@Override
@NotNull @NotNull
public String getName() { public String name() {
return this.name; return this.name;
} }
@Override
@NotNull @NotNull
public BitSet getAffinity() { public BitSet affinity() {
return this.affinity; return this.affinity;
} }
} }