File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed
affinity/src/main/java/net/openhft/affinity Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change 1717
1818package net .openhft .affinity ;
1919
20+ import com .sun .jna .Native ;
2021import net .openhft .affinity .impl .*;
2122import org .jetbrains .annotations .NotNull ;
2223import org .slf4j .Logger ;
@@ -187,13 +188,21 @@ public static void setThreadId() {
187188 }
188189
189190 public static boolean isJNAAvailable () {
190- if (JNAAvailable == null )
191- try {
192- Class .forName ("com.sun.jna.Platform" );
193- JNAAvailable = true ;
194- } catch (ClassNotFoundException ignored ) {
191+ if (JNAAvailable == null ) {
192+ int majorVersion = Integer .parseInt (Native .VERSION .split ("\\ ." )[0 ]);
193+ if (majorVersion < 5 ) {
194+ LOGGER .warn ("Affinity library requires JNA version >= 5" );
195195 JNAAvailable = false ;
196196 }
197+ else {
198+ try {
199+ Class .forName ("com.sun.jna.Platform" );
200+ JNAAvailable = true ;
201+ } catch (ClassNotFoundException ignored ) {
202+ JNAAvailable = false ;
203+ }
204+ }
205+ }
197206 return JNAAvailable ;
198207 }
199208
You can’t perform that action at this time.
0 commit comments