You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by mc...@apache.org on 2019/06/27 12:25:20 UTC

[cassandra] branch trunk updated: Fix accessing java.nio.Bits.totalCapacity in Java11

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

mck pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 2ed2b87  Fix accessing java.nio.Bits.totalCapacity in Java11
2ed2b87 is described below

commit 2ed2b87b634c1b9d9ec9b3ba3f580f1be753972a
Author: Mick Semb Wever <mc...@apache.org>
AuthorDate: Sun Apr 7 21:29:19 2019 +1000

    Fix accessing java.nio.Bits.totalCapacity in Java11
    
     patch by Mick Semb Wever; reviewed by Robert Stupp for CASSANDRA-14757
---
 src/java/org/apache/cassandra/service/GCInspector.java | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/java/org/apache/cassandra/service/GCInspector.java b/src/java/org/apache/cassandra/service/GCInspector.java
index 657d3ad..e0a935d 100644
--- a/src/java/org/apache/cassandra/service/GCInspector.java
+++ b/src/java/org/apache/cassandra/service/GCInspector.java
@@ -69,7 +69,16 @@ public class GCInspector implements NotificationListener, GCInspectorMXBean
         try
         {
             Class<?> bitsClass = Class.forName("java.nio.Bits");
-            Field f = bitsClass.getDeclaredField("totalCapacity");
+            Field f;
+            try
+            {
+                f = bitsClass.getDeclaredField("totalCapacity");
+            }
+            catch (NoSuchFieldException ex)
+            {
+                // in Java11 it changed name to "TOTAL_CAPACITY"
+                f = bitsClass.getDeclaredField("TOTAL_CAPACITY");
+            }
             f.setAccessible(true);
             temp = f;
         }


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