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/26 21:27:42 UTC

[datasketches-memory] 01/02: Interim changes

This is an automated email from the ASF dual-hosted git repository.

leerho pushed a commit to branch java-11-experimental
in repository https://gitbox.apache.org/repos/asf/datasketches-memory.git

commit b42de5d2e48b7c91a71874586f39d8b2b528a5ff
Author: Lee Rhodes <le...@users.noreply.github.com>
AuthorDate: Thu Mar 25 14:36:31 2021 -0700

    Interim changes
---
 .../java/org/apache/datasketches/memory/AllocateDirectMap.java    | 4 ++--
 src/main/java/org/apache/datasketches/memory/NioBits.java         | 8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/main/java/org/apache/datasketches/memory/AllocateDirectMap.java b/src/main/java/org/apache/datasketches/memory/AllocateDirectMap.java
index 65bc516..a2eca6c 100644
--- a/src/main/java/org/apache/datasketches/memory/AllocateDirectMap.java
+++ b/src/main/java/org/apache/datasketches/memory/AllocateDirectMap.java
@@ -69,11 +69,11 @@ class AllocateDirectMap implements Map {
   static {
     try {
       FILE_CHANNEL_IMPL_MAP0_METHOD = FileChannelImpl.class
-          .getDeclaredMethod("map0", int.class, long.class, long.class);
+          .getDeclaredMethod("map0", int.class, long.class, long.class); //add boolean isSync
       FILE_CHANNEL_IMPL_MAP0_METHOD.setAccessible(true);
 
       FILE_CHANNEL_IMPL_UNMAP0_METHOD = FileChannelImpl.class
-          .getDeclaredMethod("unmap0", long.class, long.class);
+          .getDeclaredMethod("unmap0", long.class, long.class); //OK
       FILE_CHANNEL_IMPL_UNMAP0_METHOD.setAccessible(true);
 
       MAPPED_BYTE_BUFFER_LOAD0_METHOD = MappedByteBuffer.class
diff --git a/src/main/java/org/apache/datasketches/memory/NioBits.java b/src/main/java/org/apache/datasketches/memory/NioBits.java
index 973fb54..72fdde6 100644
--- a/src/main/java/org/apache/datasketches/memory/NioBits.java
+++ b/src/main/java/org/apache/datasketches/memory/NioBits.java
@@ -66,11 +66,11 @@ final class NioBits {
       NIO_BITS_CLASS = Class.forName("java.nio.Bits");
 
       NIO_BITS_RESERVE_MEMORY_METHOD = NIO_BITS_CLASS
-          .getDeclaredMethod("reserveMemory", long.class, int.class);
+          .getDeclaredMethod("reserveMemory", long.class, long.class); //was (long, int)
       NIO_BITS_RESERVE_MEMORY_METHOD.setAccessible(true);
 
       NIO_BITS_UNRESERVE_MEMORY_METHOD = NIO_BITS_CLASS
-          .getDeclaredMethod("unreserveMemory", long.class, int.class);
+          .getDeclaredMethod("unreserveMemory", long.class, long.class); //was (long, int)
       NIO_BITS_UNRESERVE_MEMORY_METHOD.setAccessible(true);
 
       final Field countField = NIO_BITS_CLASS.getDeclaredField("COUNT");
@@ -165,9 +165,9 @@ final class NioBits {
     while (capacity > 0) {
       final long chunk = Math.min(capacity, chunkSizeLimit);
       if (capacity == chunk) {
-        method.invoke(null, allocationSize, (int) capacity);
+        method.invoke(null, allocationSize, capacity); //remove cast to int
       } else {
-        method.invoke(null, chunk, (int) chunk);
+        method.invoke(null, chunk, chunk); //remove cast to int
       }
       capacity -= chunk;
       allocationSize -= chunk;

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org