Skip to content

Commit d16bf60

Browse files
committed
Refactor AffinityLock methods to improve CPU ID validation and logging
1 parent df7941e commit d16bf60

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

affinity/src/main/java/net/openhft/affinity/AffinityLock.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,12 @@ private static boolean isInvalidCpuId(int cpuId) {
201201
return false;
202202
}
203203

204+
private static void checkCpuId(int cpuId) {
205+
if (cpuId < 0 || cpuId >= PROCESSORS) {
206+
LOGGER.warn("cpuId must be between 0 and {}: {}", PROCESSORS - 1, cpuId);
207+
}
208+
}
209+
204210
/**
205211
* Assign a cpu which can be bound to the current thread or another thread
206212
* Caller passes in an explicit set of preferred CPUs

0 commit comments

Comments
 (0)