You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datasketches.apache.org by le...@apache.org on 2021/03/29 16:55:11 UTC
[datasketches-memory] 01/01: Update comments wrt JDK 9 - 16
This is an automated email from the ASF dual-hosted git repository.
leerho pushed a commit to branch JDK15
in repository https://gitbox.apache.org/repos/asf/datasketches-memory.git
commit 048623f1e2540d89c17da1f47c317b5d2c97260d
Author: Lee Rhodes <le...@users.noreply.github.com>
AuthorDate: Mon Mar 29 09:52:50 2021 -0700
Update comments wrt JDK 9 - 16
---
pom.xml | 2 +-
.../org/apache/datasketches/memory/AllocateDirectMap.java | 12 +++++++-----
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/pom.xml b/pom.xml
index 2ab1d04..cfdef41 100644
--- a/pom.xml
+++ b/pom.xml
@@ -95,7 +95,7 @@ under the License.
<!-- System-wide properties -->
<maven.version>3.5.0</maven.version>
- <java.version>11</java.version>
+ <java.version>15</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<argLine>-Xmx4g -Duser.language=en -Duser.country=US -Dfile.encoding=UTF-8</argLine>
diff --git a/src/main/java/org/apache/datasketches/memory/AllocateDirectMap.java b/src/main/java/org/apache/datasketches/memory/AllocateDirectMap.java
index 168d2ef..0dfa2ab 100644
--- a/src/main/java/org/apache/datasketches/memory/AllocateDirectMap.java
+++ b/src/main/java/org/apache/datasketches/memory/AllocateDirectMap.java
@@ -67,15 +67,17 @@ class AllocateDirectMap implements Map {
static final Method MAPPED_BYTE_BUFFER_FORCE0_METHOD;
static {
- try {
+ try { //The FileChannelImpl methods map0 and unmap0 still exist in 16
FILE_CHANNEL_IMPL_MAP0_METHOD = FileChannelImpl.class
- .getDeclaredMethod("map0", int.class, long.class, long.class); //JDK14 add boolean.class
+ .getDeclaredMethod("map0", int.class, long.class, long.class, boolean.class); //JDK14 add boolean.class
FILE_CHANNEL_IMPL_MAP0_METHOD.setAccessible(true);
FILE_CHANNEL_IMPL_UNMAP0_METHOD = FileChannelImpl.class
.getDeclaredMethod("unmap0", long.class, long.class); //OK through jDK16
FILE_CHANNEL_IMPL_UNMAP0_METHOD.setAccessible(true);
+
+ //The MappedByteBuffer methods load0, isLoaded0 and force0 are removed in 15
MAPPED_BYTE_BUFFER_LOAD0_METHOD = MappedByteBuffer.class
.getDeclaredMethod("load0", long.class, long.class); //JDK15 removed
MAPPED_BYTE_BUFFER_LOAD0_METHOD.setAccessible(true);
@@ -228,10 +230,10 @@ class AllocateDirectMap implements Map {
final long mapPosition = position - pagePosition;
final long mapSize = lengthBytes + pagePosition;
final int mapMode = resourceReadOnly ? MAP_RO : MAP_RW;
- //final boolean isSync = true; //required as of JDK14
+ final boolean isSync = true; //required as of JDK14 //TODO add getIsSync()
try {
- final long nativeBaseOffset =
- (long) FILE_CHANNEL_IMPL_MAP0_METHOD.invoke(fileChannel, mapMode, mapPosition, mapSize); //JDK14 add isSync
+ final long nativeBaseOffset = //JDK14 add isSync
+ (long) FILE_CHANNEL_IMPL_MAP0_METHOD.invoke(fileChannel, mapMode, mapPosition, mapSize, isSync);
return nativeBaseOffset;
} catch (final InvocationTargetException e) {
throw new RuntimeException("Exception while mapping", e.getTargetException());
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org