Skip to content

Commit 53d50c0

Browse files
committed
Big new line kull.
1 parent d31f5f5 commit 53d50c0

10 files changed

Lines changed: 19 additions & 4 deletions

File tree

affinity/src/main/java/java/lang/ThreadLifecycleListener.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,4 @@ public interface ThreadLifecycleListener {
4040
* @param t the thread that has been terminated
4141
*/
4242
void terminated(Thread t);
43-
4443
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ public void bind(boolean wholeCore) {
207207

208208
if (wholeCore) {
209209
lockInventory.bindWholeCore(cpuId);
210+
210211
} else if (cpuId >= 0) {
211212
bound = true;
212213
assignedThread = Thread.currentThread();

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,23 +44,28 @@ public enum AffinitySupport {
4444
if (osName.contains("Win") && isWindowsJNAAffinityUsable()) {
4545
LOGGER.trace("Using Windows JNA-based affinity control implementation");
4646
AFFINITY_IMPL = WindowsJNAAffinity.INSTANCE;
47+
4748
} else if (osName.contains("x")) {
4849
if(osName.startsWith("Linux") && isLinuxJNAAffinityUsable()) {
4950
LOGGER.trace("Using Linux JNA-based affinity control implementation");
5051
AFFINITY_IMPL = LinuxJNAAffinity.INSTANCE;
52+
5153
} else if(isPosixJNAAffinityUsable()) {
5254
LOGGER.trace("Using Posix JNA-based affinity control implementation");
5355
AFFINITY_IMPL = PosixJNAAffinity.INSTANCE;
56+
5457
} else {
5558
LOGGER.info("Using dummy affinity control implementation");
5659
AFFINITY_IMPL = NullAffinity.INSTANCE;
5760
}
5861
} else if (osName.contains("Mac") && isMacJNAAffinityUsable()) {
5962
LOGGER.trace("Using MAC OSX JNA-based thread id implementation");
6063
AFFINITY_IMPL = OSXJNAAffinity.INSTANCE;
64+
6165
} else if (osName.contains("SunOS") && isSolarisJNAAffinityUsable()) {
6266
LOGGER.trace("Using Solaris JNA-based thread id implementation");
6367
AFFINITY_IMPL = SolarisJNAAffinity.INSTANCE;
68+
6469
} else {
6570
LOGGER.info("Using dummy affinity control implementation");
6671
AFFINITY_IMPL = NullAffinity.INSTANCE;
@@ -116,6 +121,7 @@ private static boolean isLinuxJNAAffinityUsable() {
116121
private static boolean isMacJNAAffinityUsable() {
117122
if (isJNAAvailable()) {
118123
return true;
124+
119125
} else {
120126
LOGGER.warn("MAX OSX JNA-based affinity not usable due to JNA not being available!");
121127
return false;
@@ -125,6 +131,7 @@ private static boolean isMacJNAAffinityUsable() {
125131
private static boolean isSolarisJNAAffinityUsable() {
126132
if (isJNAAvailable()) {
127133
return true;
134+
128135
} else {
129136
LOGGER.warn("Solaris JNA-based affinity not usable due to JNA not being available!");
130137
return false;

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ public final synchronized void bindWholeCore(int logicalCoreID) {
119119
for (AffinityLock al : physicalCoreLocks.get(core)) {
120120
if (al.isBound() && al.assignedThread != null && al.assignedThread.isAlive()) {
121121
LOGGER.warn("cpu {} already bound to {}", al.cpuId(), al.assignedThread);
122+
122123
} else {
123124
al.bound = true;
124125
al.assignedThread = Thread.currentThread();
@@ -145,6 +146,7 @@ public final synchronized void release() {
145146
LOGGER.info("Releasing cpu {} from {}", al.cpuId(), t);
146147
al.assignedThread = null;
147148
al.bound = false;
149+
148150
} else if (at != null && !at.isAlive()) {
149151
LOGGER.warn("Releasing cpu {} from {} as it is not alive.", al.cpuId(), t);
150152
al.assignedThread = null;

affinity/src/main/java/net/openhft/affinity/impl/LinuxHelper.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ public static void sched_setaffinity(final long affinity) {
212212
final int size = version.isSameOrNewer(VERSION_2_6) ? cpu_set_t.SIZE_OF_CPU_SET_T : NativeLong.SIZE;
213213
if(Platform.is64Bit()) {
214214
cpuset.__bits[0].setValue(affinity);
215+
215216
} else {
216217
cpuset.__bits[0].setValue(affinity & 0xFFFFFFFFL);
217218
cpuset.__bits[1].setValue((affinity >>> 32) & 0xFFFFFFFFL);
@@ -253,6 +254,7 @@ public static int sched_getcpu() {
253254
final IntByReference cpu = new IntByReference();
254255
if(getcpu.invokeInt(new Object[] { cpu, null, null }) < 0) {
255256
throw new IllegalStateException("getcpu() failed; errno=" + Native.getLastError());
257+
256258
} else {
257259
return cpu.getValue();
258260
}

affinity/src/main/java/net/openhft/affinity/impl/NullAffinity.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,4 @@ public int getProcessId() {
5656
public int getThreadId() {
5757
throw new UnsupportedOperationException();
5858
}
59-
6059
}

affinity/src/main/java/net/openhft/affinity/impl/SolarisJNAAffinity.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
package net.openhft.affinity.impl;
2020

21-
2221
import com.sun.jna.LastErrorException;
2322
import com.sun.jna.Library;
2423
import com.sun.jna.Native;
@@ -76,6 +75,5 @@ interface CLibrary extends Library {
7675
Native.loadLibrary("c", CLibrary.class);
7776

7877
int pthread_self() throws LastErrorException;
79-
8078
}
8179
}

affinity/src/main/java/net/openhft/affinity/impl/VersionHelper.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public VersionHelper(String ver) {
1818
major = parts.length > 0 ? Integer.parseInt(parts[0]) : 0;
1919
minor = parts.length > 1 ? Integer.parseInt(parts[1]) : 0;
2020
release = parts.length > 2 ? Integer.parseInt(parts[2]) : 0;
21+
2122
} else {
2223
major = minor = release = 0;
2324
}
@@ -33,6 +34,7 @@ public boolean equals(Object o) {
3334
return this.major == ver.major
3435
&& this.minor == ver.minor
3536
&& this.release == ver.release;
37+
3638
} else {
3739
return false;
3840
}

affinity/src/test/java/net/openhft/affinity/AffinityLockTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ public void assignReleaseThread() throws IOException {
121121
System.out.println("Cannot run affinity test as no threads gave been reserved.");
122122
System.out.println("Use isolcpus= in grub.conf or use -D" + AffinityLock.AFFINITY_RESERVED + "={hex mask}");
123123
return;
124+
124125
} else if (!new File("/proc/cpuinfo").exists()) {
125126
System.out.println("Cannot run affinity test as this system doesn't have a /proc/cpuinfo file");
126127
return;
@@ -155,6 +156,7 @@ public void testIssue21() throws IOException {
155156
assertNotSame(alForAnotherThread.cpuId(), alForAnotherThread2.cpuId());
156157

157158
alForAnotherThread2.release();
159+
158160
} else {
159161
assertNotSame(alForAnotherThread, al);
160162
assertNotSame(alForAnotherThread.cpuId(), al.cpuId());

affinity/src/test/java/org/junit/Assert.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,12 @@ static public void assertEquals(String message, Object expected,
130130
Object actual) {
131131
if (equalsRegardingNull(expected, actual)) {
132132
return;
133+
133134
} else if (expected instanceof String && actual instanceof String) {
134135
String cleanMessage = message == null ? "" : message;
135136
throw new ComparisonFailure(cleanMessage, (String) expected,
136137
(String) actual);
138+
137139
} else {
138140
failNotEquals(message, expected, actual);
139141
}
@@ -775,6 +777,7 @@ static String format(String message, Object expected, Object actual) {
775777
return formatted + "expected: "
776778
+ formatClassAndValue(expected, expectedString)
777779
+ " but was: " + formatClassAndValue(actual, actualString);
780+
778781
} else {
779782
return formatted + "expected:<" + expectedString + "> but was:<"
780783
+ actualString + ">";

0 commit comments

Comments
 (0)