cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject [2/3] git commit: prefer MemoryUtil.getByteBuffer to JNA Native.getDirectByteBuffer; specify native endian on the former patch by bes; reviewed by jbellis for CASSANDRA-6575
Date Thu, 08 May 2014 21:45:10 GMT
prefer MemoryUtil.getByteBuffer to JNA Native.getDirectByteBuffer; specify native endian on
the former
patch by bes; reviewed by jbellis for CASSANDRA-6575


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/1ac72f63
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/1ac72f63
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/1ac72f63

Branch: refs/heads/trunk
Commit: 1ac72f637cdfc9876d2d121302061e46ac104bf8
Parents: 0b26c77
Author: Jonathan Ellis <jbellis@apache.org>
Authored: Thu May 8 16:44:35 2014 -0500
Committer: Jonathan Ellis <jbellis@apache.org>
Committed: Thu May 8 16:44:35 2014 -0500

----------------------------------------------------------------------
 src/java/org/apache/cassandra/io/util/Memory.java          | 5 +++--
 src/java/org/apache/cassandra/utils/memory/MemoryUtil.java | 1 +
 2 files changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/1ac72f63/src/java/org/apache/cassandra/io/util/Memory.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/io/util/Memory.java b/src/java/org/apache/cassandra/io/util/Memory.java
index b8a46bc..67dee81 100644
--- a/src/java/org/apache/cassandra/io/util/Memory.java
+++ b/src/java/org/apache/cassandra/io/util/Memory.java
@@ -22,6 +22,7 @@ import java.nio.ByteOrder;
 
 import com.sun.jna.Native;
 import org.apache.cassandra.config.DatabaseDescriptor;
+import org.apache.cassandra.utils.memory.MemoryUtil;
 import sun.misc.Unsafe;
 import sun.nio.ch.DirectBuffer;
 
@@ -329,10 +330,10 @@ public class Memory
         int size = (int) (size() / result.length);
         for (int i = 0 ; i < result.length - 1 ; i++)
         {
-            result[i] = Native.getDirectByteBuffer(peer + offset, size);
+            result[i] = MemoryUtil.getByteBuffer(peer + offset, size);
             offset += size;
         }
-        result[result.length - 1] = Native.getDirectByteBuffer(peer + offset, (int) (size()
- offset));
+        result[result.length - 1] = MemoryUtil.getByteBuffer(peer + offset, (int) (size()
- offset));
         return result;
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cassandra/blob/1ac72f63/src/java/org/apache/cassandra/utils/memory/MemoryUtil.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/utils/memory/MemoryUtil.java b/src/java/org/apache/cassandra/utils/memory/MemoryUtil.java
index 5f7d410..532d071 100644
--- a/src/java/org/apache/cassandra/utils/memory/MemoryUtil.java
+++ b/src/java/org/apache/cassandra/utils/memory/MemoryUtil.java
@@ -125,6 +125,7 @@ public abstract class MemoryUtil
         unsafe.putLong(instance, DIRECT_BYTE_BUFFER_ADDRESS_OFFSET, address);
         unsafe.putInt(instance, DIRECT_BYTE_BUFFER_CAPACITY_OFFSET, length);
         unsafe.putInt(instance, DIRECT_BYTE_BUFFER_LIMIT_OFFSET, length);
+        instance.order(ByteOrder.nativeOrder());
         return instance;
     }
 


Mime
View raw message