This commit is contained in:
Andrea Cavalli 2021-09-03 02:22:55 +02:00
parent a8028024c8
commit 47de651c94
5 changed files with 9 additions and 11 deletions

View File

@ -364,8 +364,8 @@ public class LLUtils {
);
}
if (!MemorySegmentUtils.isSupported()) {
throw new UnsupportedOperationException("Please enable Foreign Memory Access API support or disable"
+ " netty direct buffers");
throw new UnsupportedOperationException("Foreign Memory Access API support is disabled."
+ " Please set \"--enable-preview --add-modules jdk.incubator.foreign -Dforeign.restricted=permit\"");
}
assert buffer.isAccessible();
long nativeAddress;

View File

@ -98,8 +98,8 @@ public class LLLocalKeyValueDatabase implements LLKeyValueDatabase {
);
}
if (!MemorySegmentUtils.isSupported()) {
throw new UnsupportedOperationException("Please enable Foreign Memory Access API support or disable"
+ " netty direct buffers");
throw new UnsupportedOperationException("Foreign Memory Access API support is disabled."
+ " Please set \"--enable-preview --add-modules jdk.incubator.foreign -Dforeign.restricted=permit\"");
}
}

View File

@ -75,12 +75,14 @@ public class MemorySegmentUtils {
if (PlatformDependent.hasDirectBufferNoCleanerConstructor()) {
return PlatformDependent.directBuffer(address, (int) size);
}
throw new UnsupportedOperationException("Foreign Memory Access API is not enabled!");
throw new UnsupportedOperationException("Foreign Memory Access API is disabled!"
+ " Please set \"--enable-preview --add-modules jdk.incubator.foreign -Dforeign.restricted=permit\"");
}
var memorySegment = AS_SLICE.invoke(NATIVE, address, size);
return (ByteBuffer) AS_BYTE_BUFFER.invoke(memorySegment);
} catch (Throwable e) {
throw new UnsupportedOperationException("Foreign Memory Access API is not enabled!", e);
throw new UnsupportedOperationException("Foreign Memory Access API is disabled!"
+ " Please set \"--enable-preview --add-modules jdk.incubator.foreign -Dforeign.restricted=permit\"", e);
}
}

View File

@ -22,25 +22,21 @@ public class JMXPooledNettyMonitoring extends JMXNettyMonitoring implements JMXN
//noinspection JavaReflectionMemberAccess
numThreadLocalCaches = metric.getClass().getDeclaredField("numThreadLocalCaches");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
try {
//noinspection JavaReflectionMemberAccess
smallCacheSize = metric.getClass().getDeclaredField("smallCacheSize");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
try {
//noinspection JavaReflectionMemberAccess
normalCacheSize = metric.getClass().getDeclaredField("normalCacheSize");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
try {
//noinspection JavaReflectionMemberAccess
chunkSize = metric.getClass().getDeclaredField("chunkSize");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
}

View File

@ -114,7 +114,7 @@ public class DbTestUtils {
if (!MemorySegmentUtils.isSupported()) {
System.err.println("Warning! Foreign Memory Access API is not available!"
+ " Netty direct buffers will not be used in tests!"
+ " Please set \"--enable-preview --add-modules jdk.incubator.foreign --foreign.restricted=permit\"");
+ " Please set \"--enable-preview --add-modules jdk.incubator.foreign -Dforeign.restricted=permit\"");
if (MemorySegmentUtils.getUnsupportedCause() != null) {
System.err.println("\tCause: " + MemorySegmentUtils.getUnsupportedCause().getClass().getName()
+ ":" + MemorySegmentUtils.getUnsupportedCause().getLocalizedMessage());