You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by sn...@apache.org on 2018/07/26 16:22:56 UTC

[4/4] cassandra git commit: Make C* compile and run on Java 11 and Java 8

Make C* compile and run on Java 11 and Java 8

patch by Robert Stupp; reviewed by Jason Brown for CASSANDRA-9608


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

Branch: refs/heads/trunk
Commit: 6ba2fb9395226491872b41312d978a169f36fcdb
Parents: 176d4ba
Author: Robert Stupp <sn...@snazy.de>
Authored: Tue Sep 12 20:04:30 2017 +0200
Committer: Robert Stupp <sn...@snazy.de>
Committed: Thu Jul 26 18:20:00 2018 +0200

----------------------------------------------------------------------
 .circleci/config.yml                            |   4 +-
 .gitignore                                      |   2 +
 CHANGES.txt                                     |   1 +
 NEWS.txt                                        |   5 +
 bin/cassandra                                   |  24 +-
 bin/cassandra.bat                               |   2 +-
 bin/cassandra.in.sh                             | 100 +++++++-
 bin/debug-cql                                   |  12 -
 bin/fqltool                                     |  12 -
 bin/nodetool                                    |  14 +-
 bin/sstableloader                               |  12 -
 bin/sstablescrub                                |  12 -
 bin/sstableupgrade                              |  12 -
 bin/sstableutil                                 |  12 -
 bin/sstableverify                               |  12 -
 build.xml                                       | 230 ++++++++++++-----
 conf/cassandra-env.ps1                          |  11 +-
 conf/cassandra-env.sh                           |  76 ++----
 conf/jvm-clients.options                        |  10 +
 conf/jvm-server.options                         | 191 ++++++++++++++
 conf/jvm.options                                | 254 -------------------
 conf/jvm11-clients.options                      |  21 ++
 conf/jvm11-server.options                       |  89 +++++++
 conf/jvm8-clients.options                       |   9 +
 conf/jvm8-server.options                        |  76 ++++++
 debian/cassandra.in.sh                          |  84 +++++-
 debian/cassandra.install                        |   2 +-
 ide/idea-iml-file.xml                           |   5 +-
 ide/idea/misc.xml                               |   2 +-
 ide/idea/workspace.xml                          |   6 +-
 lib/asm-5.0.4.jar                               | Bin 53297 -> 0 bytes
 lib/asm-6.2.jar                                 | Bin 0 -> 111214 bytes
 lib/chronicle-bytes-1.10.1.jar                  | Bin 273664 -> 0 bytes
 lib/chronicle-bytes-1.16.3.jar                  | Bin 0 -> 289991 bytes
 lib/chronicle-core-1.16.3-SNAPSHOT.jar          | Bin 0 -> 218156 bytes
 lib/chronicle-core-1.9.21.jar                   | Bin 199833 -> 0 bytes
 lib/chronicle-queue-4.16.3.jar                  | Bin 0 -> 237198 bytes
 lib/chronicle-queue-4.6.55.jar                  | Bin 215247 -> 0 bytes
 lib/chronicle-threads-1.16.0.jar                | Bin 0 -> 50299 bytes
 lib/chronicle-threads-1.9.1.jar                 | Bin 40530 -> 0 bytes
 lib/chronicle-wire-1.10.1.jar                   | Bin 419054 -> 0 bytes
 lib/chronicle-wire-1.16.1.jar                   | Bin 0 -> 437898 bytes
 lib/ecj-4.4.2.jar                               | Bin 2310271 -> 0 bytes
 lib/ecj-4.6.1.jar                               | Bin 0 -> 2440899 bytes
 lib/jamm-0.3.0.jar                              | Bin 21033 -> 0 bytes
 lib/jamm-0.3.2.jar                              | Bin 0 -> 22572 bytes
 lib/licenses/asm-5.0.4.txt                      |  29 ---
 lib/licenses/asm-6.2.txt                        |  29 +++
 lib/licenses/chronicle-bytes-1.10.1.txt         |  14 -
 lib/licenses/chronicle-bytes-1.16.3.txt         |  14 +
 lib/licenses/chronicle-core-1.16.3-SNAPSHOT.txt |  14 +
 lib/licenses/chronicle-core-1.9.21.txt          |  14 -
 lib/licenses/chronicle-queue-4.16.3.txt         |  14 +
 lib/licenses/chronicle-queue-4.6.55.txt         |  14 -
 lib/licenses/chronicle-threads-1.16.0.txt       |  14 +
 lib/licenses/chronicle-threads-1.9.1.txt        |  14 -
 lib/licenses/chronicle-wire-1.10.1.txt          |  14 -
 lib/licenses/chronicle-wire-1.16.1.txt          |  14 +
 lib/licenses/ecj-4.4.2.txt                      | 210 ---------------
 lib/licenses/ecj-4.6.1.txt                      | 210 +++++++++++++++
 lib/licenses/jamm-0.3.0.txt                     | 202 ---------------
 lib/licenses/jamm-0.3.2.txt                     | 202 +++++++++++++++
 lib/licenses/ohc-0.4.4.txt                      | 201 ---------------
 lib/licenses/ohc-0.5.1.txt                      | 201 +++++++++++++++
 lib/ohc-core-0.4.4.jar                          | Bin 135369 -> 0 bytes
 lib/ohc-core-0.5.1.jar                          | Bin 0 -> 122716 bytes
 lib/ohc-core-j8-0.4.4.jar                       | Bin 4995 -> 0 bytes
 lib/ohc-core-j8-0.5.1.jar                       | Bin 0 -> 4306 bytes
 redhat/cassandra.in.sh                          |  84 +++++-
 .../cassandra/cache/SerializingCache.java       |   2 +
 .../cassandra/config/DatabaseDescriptor.java    |   6 +
 .../cql3/functions/JavaBasedUDFunction.java     |  11 +-
 .../cql3/functions/ScriptBasedUDFunction.java   |   8 +
 src/java/org/apache/cassandra/db/Memtable.java  |   4 -
 .../apache/cassandra/db/RangeTombstoneList.java |   1 +
 .../org/apache/cassandra/db/ReadCommand.java    |   1 +
 .../db/SinglePartitionReadCommand.java          |   2 +
 .../cassandra/db/VirtualTableReadQuery.java     |   1 +
 .../db/commitlog/MemoryMappedSegment.java       |   3 +-
 .../cassandra/db/compaction/Scrubber.java       |   1 +
 .../apache/cassandra/db/filter/RowFilter.java   |   2 +
 .../db/partitions/AtomicBTreePartition.java     |   9 +-
 .../db/partitions/PartitionUpdate.java          |   3 +
 .../cassandra/db/partitions/PurgeFunction.java  |   1 +
 .../UnfilteredPartitionIterators.java           |   3 +
 src/java/org/apache/cassandra/db/rows/Row.java  |   2 +
 src/java/org/apache/cassandra/db/rows/Rows.java |   1 +
 .../cassandra/db/transform/BasePartitions.java  |   1 +
 .../apache/cassandra/db/transform/Filter.java   |   1 +
 .../db/transform/FilteredPartitions.java        |   2 +
 .../cassandra/db/view/ViewBuilderTask.java      |   1 +
 .../db/virtual/AbstractVirtualTable.java        |   1 +
 src/java/org/apache/cassandra/index/Index.java  |   1 +
 .../index/internal/CassandraIndex.java          |   1 +
 .../internal/composites/CompositesSearcher.java |   1 +
 .../index/sasi/utils/MappedBuffer.java          |   3 -
 .../io/sstable/format/big/BigTableReader.java   |   1 +
 .../org/apache/cassandra/io/util/FileUtils.java |  90 +++++--
 .../org/apache/cassandra/io/util/Memory.java    |   5 +-
 .../cassandra/io/util/MmappedRegions.java       |   8 -
 .../security/ThreadAwareSecurityManager.java    |  19 +-
 .../cassandra/service/reads/DataResolver.java   |   1 +
 .../service/reads/ShortReadProtection.java      |   1 +
 .../org/apache/cassandra/tools/NodeTool.java    |   5 +
 .../apache/cassandra/tools/SSTableExport.java   |   5 +
 .../cassandra/triggers/CustomClassLoader.java   |   6 +-
 .../cassandra/utils/CoalescingStrategies.java   |   2 +-
 .../org/apache/cassandra/utils/FBUtilities.java |  24 ++
 .../apache/cassandra/utils/JMXServerUtils.java  |  30 ++-
 .../apache/cassandra/utils/MergeIterator.java   |   1 +
 .../apache/cassandra/utils/NativeLibrary.java   |  10 +-
 .../org/apache/cassandra/utils/ObjectSizes.java |   2 +-
 .../org/apache/cassandra/utils/Throwables.java  |   2 +-
 .../cassandra/utils/concurrent/Locks.java       |  54 ----
 .../cassandra/utils/memory/MemoryUtil.java      |   3 +-
 .../cassandra/utils/memory/SlabAllocator.java   |   4 +-
 .../db/partitions/AtomicBTreePartitionBase.java |  60 +++++
 .../db/partitions/AtomicBTreePartitionBase.java |  81 ++++++
 src/jdkoverride/java/util/zip/CRC32.class       | Bin 549 -> 0 bytes
 .../cassandra/audit/FullQueryLoggerTest.java    |   5 +-
 .../config/DatabaseDescriptorRefTest.java       |  17 +-
 .../cql3/validation/entities/UFJavaTest.java    |   2 +-
 .../validation/entities/UFSecurityTest.java     |  15 +-
 .../apache/cassandra/db/DirectoriesTest.java    |   2 +-
 .../org/apache/cassandra/db/MmapFileTest.java   |  16 +-
 .../apache/cassandra/db/RowIndexEntryTest.java  |   6 +-
 .../unit/org/apache/cassandra/db/ScrubTest.java |   2 +-
 .../cassandra/db/commitlog/CommitLogTest.java   |   5 +-
 .../db/commitlog/SegmentReaderTest.java         |   5 +-
 .../hints/ChecksummedDataInputTest.java         |   7 +-
 .../index/sasi/disk/OnDiskIndexTest.java        |  33 +--
 .../index/sasi/disk/TokenTreeTest.java          |  12 +-
 .../index/sasi/utils/MappedBufferTest.java      |   4 +-
 .../CompressedRandomAccessReaderTest.java       |  22 +-
 .../CompressedSequentialWriterTest.java         |  12 +-
 .../cassandra/io/compress/CompressorTest.java   |   3 +-
 .../cassandra/io/sstable/DescriptorTest.java    |   3 +-
 .../cassandra/io/sstable/SSTableUtils.java      |   3 +-
 .../metadata/MetadataSerializerTest.java        |   3 +-
 .../io/util/BufferedRandomAccessFileTest.java   |  12 +-
 .../util/ChecksummedRandomAccessReaderTest.java |  12 +-
 .../cassandra/io/util/MmappedRegionsTest.java   |   6 +-
 .../io/util/NIODataInputStreamTest.java         |   2 +-
 .../io/util/RandomAccessReaderTest.java         |   8 +-
 .../util/RewindableDataInputStreamPlusTest.java |   2 +-
 .../net/async/MessageOutHandlerTest.java        |   3 -
 .../org/apache/cassandra/schema/MockSchema.java |  13 +-
 .../cassandra/security/EncryptionUtilsTest.java |   5 +-
 .../compression/CompressedInputStreamTest.java  |   3 +-
 .../cassandra/utils/binlog/BinLogTest.java      |   3 +-
 .../utils/concurrent/RefCountedTest.java        |   3 +-
 tools/bin/cassandra-stress                      |  12 -
 tools/bin/cassandra-stressd                     |  12 -
 tools/bin/cassandra.in.sh                       |  95 ++++++-
 tools/bin/compaction-stress                     |  12 -
 tools/bin/sstabledump                           |  12 -
 tools/bin/sstableexpiredblockers                |  12 -
 tools/bin/sstablelevelreset                     |  12 -
 tools/bin/sstablemetadata                       |  12 -
 tools/bin/sstableofflinerelevel                 |  12 -
 tools/bin/sstablerepairedset                    |  12 -
 tools/bin/sstablesplit                          |  12 -
 .../stress/settings/SettingsGraph.java          |  10 +-
 163 files changed, 2176 insertions(+), 1595 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/6ba2fb93/.circleci/config.yml
----------------------------------------------------------------------
diff --git a/.circleci/config.yml b/.circleci/config.yml
index 5a84f72..edf7dd5 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -65,9 +65,9 @@ env_vars: &env_vars
     #<<: *high_capacity_env_vars
 workflows:
     version: 2
-    build_and_run_tests: *default_jobs
+    #build_and_run_tests: *default_jobs
     #build_and_run_tests: *with_dtest_jobs_only
-    #build_and_run_tests: *with_dtest_jobs
+    build_and_run_tests: *with_dtest_jobs
 docker_image: &docker_image kjellman/cassandra-test:0.4.3
 version: 2
 jobs:

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6ba2fb93/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index 76c4bd1..71b3087 100644
--- a/.gitignore
+++ b/.gitignore
@@ -76,3 +76,5 @@ lib/jsr223/scala/*.jar
 # Generated files from the documentation
 doc/source/configuration/cassandra_config_file.rst
 doc/source/tools/nodetool
+
+audit

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6ba2fb93/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 4ba3313..6b6418c 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 4.0
+ * Add experimental support for Java 11 (CASSANDRA-9608)
  * Make PeriodicCommitLogService.blockWhenSyncLagsNanos configurable (CASSANDRA-14580)
  * Improve logging in MessageInHandler's constructor (CASSANDRA-14576)
  * Set broadcast address in internode messaging handshake (CASSANDRA-14579)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6ba2fb93/NEWS.txt
----------------------------------------------------------------------
diff --git a/NEWS.txt b/NEWS.txt
index da94422..75885e9 100644
--- a/NEWS.txt
+++ b/NEWS.txt
@@ -38,6 +38,11 @@ using the provided 'sstableupgrade' tool.
 
 New features
 ------------
+   - *Experimental* support for Java 11 has been added. JVM options that differ between or are
+     specific for Java 8 and 11 have been moved from jvm.options into jvm8.options and jvm11.options.
+     IMPORTANT: Running C* on Java 11 is *experimental* and do it at your own risk.
+     Compilation recommendations: configure Java 11 SDK via JAVA_HOME and Java 8 SDK via JAVA8_HOME.
+     Release builds require Java 11 + Java 8. Development builds can use Java 8 without 11.
    - LCS now respects the max_threshold parameter when compacting - this was hard coded to 32
      before, but now it is possible to do bigger compactions when compacting from L0 to L1.
      This also applies to STCS-compactions in L0 - if there are more than 32 sstables in L0

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6ba2fb93/bin/cassandra
----------------------------------------------------------------------
diff --git a/bin/cassandra b/bin/cassandra
index 006c6ae..f5ac059 100755
--- a/bin/cassandra
+++ b/bin/cassandra
@@ -66,6 +66,9 @@
 # POSIX sh and Solaris sh. This means, in particular, no $(( )) and no $( ).
 
 # If an include wasn't specified in the environment, then search for one...
+
+jvmoptions_variant="-server"
+
 if [ "x$CASSANDRA_INCLUDE" = "x" ]; then
     # Locations (in order) to use when searching for an include file.
     for include in "`dirname "$0"`/cassandra.in.sh" \
@@ -83,27 +86,6 @@ elif [ -r "$CASSANDRA_INCLUDE" ]; then
     . "$CASSANDRA_INCLUDE"
 fi
 
-# Use JAVA_HOME if set, otherwise look for java in PATH
-if [ -n "$JAVA_HOME" ]; then
-    # Why we can't have nice things: Solaris combines x86 and x86_64
-    # installations in the same tree, using an unconventional path for the
-    # 64bit JVM.  Since we prefer 64bit, search the alternate path first,
-    # (see https://issues.apache.org/jira/browse/CASSANDRA-4638).
-    for java in "$JAVA_HOME"/bin/amd64/java "$JAVA_HOME"/bin/java; do
-        if [ -x "$java" ]; then
-            JAVA="$java"
-            break
-        fi
-    done
-else
-    JAVA=java
-fi
-
-if [ -z $JAVA ] ; then
-    echo Unable to find java executable. Check JAVA_HOME and PATH environment variables. >&2
-    exit 1;
-fi
-
 # If numactl is available, use it. For Cassandra, the priority is to
 # avoid disk I/O. Even for the purpose of CPU efficiency, we don't
 # really have CPU<->data affinity anyway. Also, empirically test that numactl

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6ba2fb93/bin/cassandra.bat
----------------------------------------------------------------------
diff --git a/bin/cassandra.bat b/bin/cassandra.bat
index a653142..24889d8 100644
--- a/bin/cassandra.bat
+++ b/bin/cassandra.bat
@@ -54,7 +54,7 @@ if NOT DEFINED JAVA_HOME goto :err
 REM -----------------------------------------------------------------------------
 REM JVM Opts we'll use in legacy run or installation
 set JAVA_OPTS=-ea^
- -javaagent:"%CASSANDRA_HOME%\lib\jamm-0.3.0.jar"^
+ -javaagent:"%CASSANDRA_HOME%\lib\jamm-0.3.2"^
  -Xms2G^
  -Xmx2G^
  -XX:+HeapDumpOnOutOfMemoryError^

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6ba2fb93/bin/cassandra.in.sh
----------------------------------------------------------------------
diff --git a/bin/cassandra.in.sh b/bin/cassandra.in.sh
index 228cef7..1de9360 100644
--- a/bin/cassandra.in.sh
+++ b/bin/cassandra.in.sh
@@ -23,11 +23,18 @@ if [ "x$CASSANDRA_CONF" = "x" ]; then
     CASSANDRA_CONF="$CASSANDRA_HOME/conf"
 fi
 
+# The java classpath (required)
+CLASSPATH="$CASSANDRA_CONF"
+
 # This can be the path to a jar file, or a directory containing the 
 # compiled classes. NOTE: This isn't needed by the startup script,
 # it's just used here in constructing the classpath.
-cassandra_bin="$CASSANDRA_HOME/build/classes/main"
-#cassandra_bin="$CASSANDRA_HOME/build/cassandra.jar"
+if [ -d $CASSANDRA_HOME/build ] ; then
+    #cassandra_bin="$CASSANDRA_HOME/build/classes/main"
+    cassandra_bin=`ls -1 $CASSANDRA_HOME/build/apache-cassandra*.jar`
+
+    CLASSPATH="$CLASSPATH:$cassandra_bin"
+fi
 
 # the default location for commitlogs, sstables, and saved caches
 # if not set in cassandra.yaml
@@ -36,9 +43,6 @@ cassandra_storagedir="$CASSANDRA_HOME/data"
 # JAVA_HOME can optionally be set here
 #JAVA_HOME=/usr/local/jdk6
 
-# The java classpath (required)
-CLASSPATH="$CASSANDRA_CONF:$cassandra_bin"
-
 for jar in "$CASSANDRA_HOME"/lib/*.jar; do
     CLASSPATH="$CLASSPATH:$jar"
 done
@@ -65,11 +69,87 @@ if [ -f "$CASSANDRA_HOME"/lib/jsr223/scala/scala-compiler.jar ] ; then
 fi
 
 # set JVM javaagent opts to avoid warnings/errors
-if [ "$JVM_VENDOR" != "OpenJDK" -o "$JVM_VERSION" \> "1.6.0" ] \
-      || [ "$JVM_VERSION" = "1.6.0" -a "$JVM_PATCH_VERSION" -ge 23 ]
-then
-    JAVA_AGENT="$JAVA_AGENT -javaagent:$CASSANDRA_HOME/lib/jamm-0.3.0.jar"
-fi
+JAVA_AGENT="$JAVA_AGENT -javaagent:$CASSANDRA_HOME/lib/jamm-0.3.2.jar"
 
 # Added sigar-bin to the java.library.path CASSANDRA-7838
 JAVA_OPTS="$JAVA_OPTS:-Djava.library.path=$CASSANDRA_HOME/lib/sigar-bin"
+
+
+#
+# Java executable and per-Java version JVM settings
+#
+
+# Use JAVA_HOME if set, otherwise look for java in PATH
+if [ -n "$JAVA_HOME" ]; then
+    # Why we can't have nice things: Solaris combines x86 and x86_64
+    # installations in the same tree, using an unconventional path for the
+    # 64bit JVM.  Since we prefer 64bit, search the alternate path first,
+    # (see https://issues.apache.org/jira/browse/CASSANDRA-4638).
+    for java in "$JAVA_HOME"/bin/amd64/java "$JAVA_HOME"/bin/java; do
+        if [ -x "$java" ]; then
+            JAVA="$java"
+            break
+        fi
+    done
+else
+    JAVA=java
+fi
+
+if [ -z $JAVA ] ; then
+    echo Unable to find java executable. Check JAVA_HOME and PATH environment variables. >&2
+    exit 1;
+fi
+
+# Determine the sort of JVM we'll be running on.
+java_ver_output=`"${JAVA:-java}" -version 2>&1`
+jvmver=`echo "$java_ver_output" | grep '[openjdk|java] version' | awk -F'"' 'NR==1 {print $2}' | cut -d\- -f1`
+JVM_VERSION=${jvmver%_*}
+
+JAVA_VERSION=11
+if [ "$JVM_VERSION" = "1.8.0" ]  ; then
+    JVM_PATCH_VERSION=${jvmver#*_}
+    if [ "$JVM_VERSION" \< "1.8" ] || [ "$JVM_VERSION" \> "1.8.2" ] ; then
+        echo "Cassandra 4.0 requires either Java 8 (update 151 or newer) or Java 11 (or newer). Java $JVM_VERSION is not supported."
+        exit 1;
+    fi
+    if [ "$JVM_PATCH_VERSION" -lt 151 ] ; then
+        echo "Cassandra 4.0 requires either Java 8 (update 151 or newer) or Java 11 (or newer). Java 8 update $JVM_PATCH_VERSION is not supported."
+        exit 1;
+    fi
+    JAVA_VERSION=8
+elif [ "$JVM_VERSION" \< "11" ] ; then
+    echo "Cassandra 4.0 requires either Java 8 (update 151 or newer) or Java 11 (or newer)."
+    exit 1;
+fi
+
+jvm=`echo "$java_ver_output" | grep -A 1 '[openjdk|java] version' | awk 'NR==2 {print $1}'`
+case "$jvm" in
+    OpenJDK)
+        JVM_VENDOR=OpenJDK
+        # this will be "64-Bit" or "32-Bit"
+        JVM_ARCH=`echo "$java_ver_output" | awk 'NR==3 {print $2}'`
+        ;;
+    "Java(TM)")
+        JVM_VENDOR=Oracle
+        # this will be "64-Bit" or "32-Bit"
+        JVM_ARCH=`echo "$java_ver_output" | awk 'NR==3 {print $3}'`
+        ;;
+    *)
+        # Help fill in other JVM values
+        JVM_VENDOR=other
+        JVM_ARCH=unknown
+        ;;
+esac
+
+# Read user-defined JVM options from jvm-server.options file
+JVM_OPTS_FILE=$CASSANDRA_CONF/jvm${jvmoptions_variant:--clients}.options
+if [ $JAVA_VERSION -ge 11 ] ; then
+    JVM_DEP_OPTS_FILE=$CASSANDRA_CONF/jvm11${jvmoptions_variant:--clients}.options
+else
+    JVM_DEP_OPTS_FILE=$CASSANDRA_CONF/jvm8${jvmoptions_variant:--clients}.options
+fi
+
+for opt in `grep "^-" $JVM_OPTS_FILE` `grep "^-" $JVM_DEP_OPTS_FILE`
+do
+  JVM_OPTS="$JVM_OPTS $opt"
+done

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6ba2fb93/bin/debug-cql
----------------------------------------------------------------------
diff --git a/bin/debug-cql b/bin/debug-cql
index 00d4093..c184df9 100755
--- a/bin/debug-cql
+++ b/bin/debug-cql
@@ -32,18 +32,6 @@ elif [ -r "$CASSANDRA_INCLUDE" ]; then
     . "$CASSANDRA_INCLUDE"
 fi
 
-# Use JAVA_HOME if set, otherwise look for java in PATH
-if [ -n "$JAVA_HOME" ]; then
-    JAVA="$JAVA_HOME/bin/java"
-else
-    JAVA=java
-fi
-
-if [ -z "$CASSANDRA_CONF" -o -z "$CLASSPATH" ]; then
-    echo "You must set the CASSANDRA_CONF and CLASSPATH vars" >&2
-    exit 1
-fi
-
 if [ -f "$CASSANDRA_CONF/cassandra-env.sh" ]; then
     . "$CASSANDRA_CONF/cassandra-env.sh"
 fi

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6ba2fb93/bin/fqltool
----------------------------------------------------------------------
diff --git a/bin/fqltool b/bin/fqltool
index 8a05af1..15a0b20 100755
--- a/bin/fqltool
+++ b/bin/fqltool
@@ -32,18 +32,6 @@ elif [ -r "$CASSANDRA_INCLUDE" ]; then
     . "$CASSANDRA_INCLUDE"
 fi
 
-# Use JAVA_HOME if set, otherwise look for java in PATH
-if [ -x "$JAVA_HOME/bin/java" ]; then
-    JAVA="$JAVA_HOME/bin/java"
-else
-    JAVA="`which java`"
-fi
-
-if [ "x$JAVA" = "x" ]; then
-    echo "Java executable not found (hint: set JAVA_HOME)" >&2
-    exit 1
-fi
-
 if [ -z "$CASSANDRA_CONF" -o -z "$CLASSPATH" ]; then
     echo "You must set the CASSANDRA_CONF and CLASSPATH vars" >&2
     exit 1

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6ba2fb93/bin/nodetool
----------------------------------------------------------------------
diff --git a/bin/nodetool b/bin/nodetool
index 6456b19..3104582 100755
--- a/bin/nodetool
+++ b/bin/nodetool
@@ -38,18 +38,6 @@ elif [ -r "$CASSANDRA_INCLUDE" ]; then
     . "$CASSANDRA_INCLUDE"
 fi
 
-# Use JAVA_HOME if set, otherwise look for java in PATH
-if [ -x "$JAVA_HOME/bin/java" ]; then
-    JAVA="$JAVA_HOME/bin/java"
-else
-    JAVA="`which java`"
-fi
-
-if [ "x$JAVA" = "x" ]; then
-    echo "Java executable not found (hint: set JAVA_HOME)" >&2
-    exit 1
-fi
-
 if [ -z "$CASSANDRA_CONF" -o -z "$CLASSPATH" ]; then
     echo "You must set the CASSANDRA_CONF and CLASSPATH vars" >&2
     exit 1
@@ -61,7 +49,7 @@ if [ -f "$CASSANDRA_CONF/cassandra-env.sh" ]; then
     MAX_HEAP_SIZE_SAVE=$MAX_HEAP_SIZE
     . "$CASSANDRA_CONF/cassandra-env.sh"
     MAX_HEAP_SIZE=$MAX_HEAP_SIZE_SAVE
-    JVM_OPTS=$JVM_OPTS_SAVE
+    JVM_OPTS="$JVM_OPTS_SAVE"
 fi
 
 # JMX Port passed via cmd line args (-p 9999 / --port 9999 / --port=9999)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6ba2fb93/bin/sstableloader
----------------------------------------------------------------------
diff --git a/bin/sstableloader b/bin/sstableloader
index 03ab4f9..9045adf 100755
--- a/bin/sstableloader
+++ b/bin/sstableloader
@@ -32,18 +32,6 @@ elif [ -r "$CASSANDRA_INCLUDE" ]; then
     . "$CASSANDRA_INCLUDE"
 fi
 
-# Use JAVA_HOME if set, otherwise look for java in PATH
-if [ -x "$JAVA_HOME/bin/java" ]; then
-    JAVA="$JAVA_HOME/bin/java"
-else
-    JAVA="`which java`"
-fi
-
-if [ "x$JAVA" = "x" ]; then
-    echo "Java executable not found (hint: set JAVA_HOME)" >&2
-    exit 1
-fi
-
 if [ -z "$CLASSPATH" ]; then
     echo "You must set the CLASSPATH var" >&2
     exit 1

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6ba2fb93/bin/sstablescrub
----------------------------------------------------------------------
diff --git a/bin/sstablescrub b/bin/sstablescrub
index 366a2b7..9adda77 100755
--- a/bin/sstablescrub
+++ b/bin/sstablescrub
@@ -32,18 +32,6 @@ elif [ -r "$CASSANDRA_INCLUDE" ]; then
     . "$CASSANDRA_INCLUDE"
 fi
 
-# Use JAVA_HOME if set, otherwise look for java in PATH
-if [ -x "$JAVA_HOME/bin/java" ]; then
-    JAVA="$JAVA_HOME/bin/java"
-else
-    JAVA="`which java`"
-fi
-
-if [ "x$JAVA" = "x" ]; then
-    echo "Java executable not found (hint: set JAVA_HOME)" >&2
-    exit 1
-fi
-
 if [ -z "$CLASSPATH" ]; then
     echo "You must set the CLASSPATH var" >&2
     exit 1

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6ba2fb93/bin/sstableupgrade
----------------------------------------------------------------------
diff --git a/bin/sstableupgrade b/bin/sstableupgrade
index 7b307eb..c48faf0 100755
--- a/bin/sstableupgrade
+++ b/bin/sstableupgrade
@@ -32,18 +32,6 @@ elif [ -r "$CASSANDRA_INCLUDE" ]; then
     . "$CASSANDRA_INCLUDE"
 fi
 
-# Use JAVA_HOME if set, otherwise look for java in PATH
-if [ -x "$JAVA_HOME/bin/java" ]; then
-    JAVA="$JAVA_HOME/bin/java"
-else
-    JAVA="`which java`"
-fi
-
-if [ "x$JAVA" = "x" ]; then
-    echo "Java executable not found (hint: set JAVA_HOME)" >&2
-    exit 1
-fi
-
 if [ -z "$CLASSPATH" ]; then
     echo "You must set the CLASSPATH var" >&2
     exit 1

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6ba2fb93/bin/sstableutil
----------------------------------------------------------------------
diff --git a/bin/sstableutil b/bin/sstableutil
index 7457834..5d0bf1f 100755
--- a/bin/sstableutil
+++ b/bin/sstableutil
@@ -32,18 +32,6 @@ elif [ -r "$CASSANDRA_INCLUDE" ]; then
     . "$CASSANDRA_INCLUDE"
 fi
 
-# Use JAVA_HOME if set, otherwise look for java in PATH
-if [ -x "$JAVA_HOME/bin/java" ]; then
-    JAVA="$JAVA_HOME/bin/java"
-else
-    JAVA="`which java`"
-fi
-
-if [ "x$JAVA" = "x" ]; then
-    echo "Java executable not found (hint: set JAVA_HOME)" >&2
-    exit 1
-fi
-
 if [ -z "$CLASSPATH" ]; then
     echo "You must set the CLASSPATH var" >&2
     exit 1

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6ba2fb93/bin/sstableverify
----------------------------------------------------------------------
diff --git a/bin/sstableverify b/bin/sstableverify
index 6b296cf..ff812b9 100755
--- a/bin/sstableverify
+++ b/bin/sstableverify
@@ -32,18 +32,6 @@ elif [ -r "$CASSANDRA_INCLUDE" ]; then
     . "$CASSANDRA_INCLUDE"
 fi
 
-# Use JAVA_HOME if set, otherwise look for java in PATH
-if [ -x "$JAVA_HOME/bin/java" ]; then
-    JAVA="$JAVA_HOME/bin/java"
-else
-    JAVA="`which java`"
-fi
-
-if [ "x$JAVA" = "x" ]; then
-    echo "Java executable not found (hint: set JAVA_HOME)" >&2
-    exit 1
-fi
-
 if [ -z "$CLASSPATH" ]; then
     echo "You must set the CLASSPATH var" >&2
     exit 1

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6ba2fb93/build.xml
----------------------------------------------------------------------
diff --git a/build.xml b/build.xml
index c3710e6..903e1ec 100644
--- a/build.xml
+++ b/build.xml
@@ -35,7 +35,8 @@
     <property name="build.src" value="${basedir}/src"/>
     <property name="build.src.java" value="${basedir}/src/java"/>
     <property name="build.src.antlr" value="${basedir}/src/antlr"/>
-    <property name="build.src.jdkoverride" value="${basedir}/src/jdkoverride" />
+    <property name="build.src.java8" value="${basedir}/src/java8"/>
+    <property name="build.src.java11" value="${basedir}/src/java11"/>
     <property name="build.src.resources" value="${basedir}/src/resources"/>
     <property name="build.src.gen-java" value="${basedir}/src/gen-java"/>
     <property name="build.lib" value="${basedir}/lib"/>
@@ -66,8 +67,14 @@
 
     <property name="doc.dir" value="${basedir}/doc"/>
 
-    <property name="source.version" value="1.8"/>
-    <property name="target.version" value="1.8"/>
+    <!--
+    We specify '8' instead of '1.8' in source.version to indicate that that this build requires Java 11 _and_ Java 8.
+    Builds that only run against Java 8, _have to_ specify '1.8' for source version. This makes it possible to let
+    CI scripts distinguish between "pure Java 8" releases and "hybrid" releases.
+    -->
+    <property name="source.version" value="8"/>
+    <property name="target.version" value="8"/>
+    <property name="release.version" value="10"/>
 
     <condition property="version" value="${base.version}">
       <isset property="release"/>
@@ -110,16 +117,18 @@
     <property name="jacoco.finalexecfile" value="${jacoco.export.dir}/jacoco.exec" />
     <property name="jacoco.version" value="0.7.5.201505241946"/>
 
-    <property name="byteman.version" value="3.0.3"/>
+    <property name="byteman.version" value="4.0.2"/>
+    <property name="jamm.version" value="0.3.2"/>
+    <property name="ecj.version" value="4.6.1"/>
+    <property name="ohc.version" value="0.5.1"/>
+    <property name="asm.version" value="6.2"/>
 
-    <property name="ecj.version" value="4.4.2"/>
-
-    <!-- https://mvnrepository.com/artifact/net.openhft/chronicle-bom/1.15.6 -->
-    <property name="chronicle-queue.version" value="4.6.55" />
-    <property name="chronicle-core.version" value="1.9.21" />
-    <property name="chronicle-bytes.version" value="1.10.1" />
-    <property name="chronicle-wire.version" value="1.10.1" />
-    <property name="chronicle-threads.version" value="1.9.1" />
+    <!-- https://mvnrepository.com/artifact/net.openhft/chronicle-bom/1.16.23 -->
+    <property name="chronicle-queue.version" value="4.16.3" />
+    <property name="chronicle-core.version" value="1.16.3-SNAPSHOT" />
+    <property name="chronicle-bytes.version" value="1.16.3" />
+    <property name="chronicle-wire.version" value="1.16.1" />
+    <property name="chronicle-threads.version" value="1.16.0" />
 
     <condition property="maven-ant-tasks.jar.exists">
       <available file="${build.dir}/maven-ant-tasks-${maven-ant-tasks.version}.jar" />
@@ -152,6 +161,24 @@
     </script>
 
     <!--
+    Build instructions for release builds / builds that support both Java 8 and 11:
+    - requires JDK 11 in JAVA_HOME
+    - requires JDK 8 in JAVA8_HOME
+
+    Build instructions for development buils that only support Java 8:
+    - requires JDK 8 in JAVA_HOME
+    -->
+    <condition property="java.version.8">
+        <equals arg1="${ant.java.version}" arg2="1.8"/>
+    </condition>
+    <condition property="java11-jvmargs" value="-Djdk.attach.allowAttachSelf=true --add-exports java.sql/java.sql=ALL-UNNAMED --add-exports java.base/jdk.internal.misc=ALL-UNNAMED --add-opens java.base/jdk.internal.module=ALL-UNNAMED --add-exports java.base/jdk.internal.ref=ALL-UNNAMED --add-exports java.base/sun.nio.ch=ALL-UNNAMED --add-exports java.management.rmi/com.sun.jmx.remote.internal.rmi=ALL-UNNAMED --add-exports java.rmi/sun.rmi.registry=ALL-UNNAMED --add-exports java.rmi/sun.rmi.server=ALL-UNNAMED --add-opens jdk.management/com.sun.management.internal=ALL-UNNAMED">
+        <not>
+            <equals arg1="${ant.java.version}" arg2="1.8"/>
+        </not>
+    </condition>
+    <property name="java11-jvmargs" value=""/>
+
+    <!--
          Add all the dependencies.
     -->
     <path id="maven-ant-tasks.classpath" path="${build.dir}/maven-ant-tasks-${maven-ant-tasks.version}.jar" />
@@ -168,6 +195,19 @@
             <exclude name="**/ant-*.jar"/>
         </fileset>
     </path>
+    <path id="cassandra.classpath.test">
+        <file file="${build.dir}/${final.name}.jar"/> <!-- we need the jar for tests and benchmarks (multi-version jar) -->
+        <fileset dir="${build.lib}">
+            <include name="**/*.jar" />
+            <exclude name="**/*-sources.jar"/>
+            <exclude name="**/ant-*.jar"/>
+        </fileset>
+        <fileset dir="${build.dir.lib}">
+            <include name="**/*.jar" />
+            <exclude name="**/*-sources.jar"/>
+            <exclude name="**/ant-*.jar"/>
+        </fileset>
+    </path>
 
   <macrodef name="create-javadoc">
     <attribute name="destdir"/>
@@ -189,7 +229,7 @@
     <target name="init">
         <fail unless="is.source.artifact"
             message="Not a source artifact, stopping here." />
-        <mkdir dir="${build.classes.main}"/>
+        <mkdir dir="${build.classes.main}/META-INF/versions/11"/>
         <mkdir dir="${test.lib}"/>
         <mkdir dir="${test.classes}"/>
         <mkdir dir="${stress.test.classes}"/>
@@ -390,7 +430,7 @@
           <dependency groupId="com.fasterxml.jackson.core" artifactId="jackson-annotations" version="2.9.5"/>
           <dependency groupId="com.googlecode.json-simple" artifactId="json-simple" version="1.1"/>
           <dependency groupId="com.boundary" artifactId="high-scale-lib" version="1.0.6"/>
-          <dependency groupId="com.github.jbellis" artifactId="jamm" version="0.3.0"/>
+          <dependency groupId="com.github.jbellis" artifactId="jamm" version="${jamm.version}"/>
 
           <dependency groupId="org.yaml" artifactId="snakeyaml" version="1.11"/>
           <dependency groupId="junit" artifactId="junit" version="4.12" />
@@ -398,15 +438,15 @@
              <exclusion groupId="commons-lang" artifactId="commons-lang"/>
           </dependency>
           <dependency groupId="org.apache.hadoop" artifactId="hadoop-core" version="1.0.3">
-          	<exclusion groupId="org.mortbay.jetty" artifactId="servlet-api"/>
-          	<exclusion groupId="commons-logging" artifactId="commons-logging"/>
-          	<exclusion groupId="org.eclipse.jdt" artifactId="core"/>
-		    <exclusion groupId="ant" artifactId="ant"/>
-		    <exclusion groupId="junit" artifactId="junit"/>
+            <exclusion groupId="org.mortbay.jetty" artifactId="servlet-api"/>
+            <exclusion groupId="commons-logging" artifactId="commons-logging"/>
+            <exclusion groupId="org.eclipse.jdt" artifactId="core"/>
+            <exclusion groupId="ant" artifactId="ant"/>
+            <exclusion groupId="junit" artifactId="junit"/>
             <exclusion groupId="org.slf4j" artifactId="slf4j-api"/>
           </dependency>
           <dependency groupId="org.apache.hadoop" artifactId="hadoop-minicluster" version="1.0.3">
-		    <exclusion groupId="asm" artifactId="asm"/> <!-- this is the outdated version 3.1 -->
+            <exclusion groupId="asm" artifactId="asm"/> <!-- this is the outdated version 3.1 -->
             <exclusion groupId="org.slf4j" artifactId="slf4j-api"/>
           </dependency>
           <dependency groupId="net.java.dev.jna" artifactId="jna" version="4.2.2"/>
@@ -419,7 +459,6 @@
           <dependency groupId="org.jboss.byteman" artifactId="byteman-submit" version="${byteman.version}"/>
           <dependency groupId="org.jboss.byteman" artifactId="byteman-bmunit" version="${byteman.version}"/>
 
-
           <dependency groupId="org.openjdk.jmh" artifactId="jmh-core" version="1.21"/>
           <dependency groupId="org.openjdk.jmh" artifactId="jmh-generator-annprocess" version="1.21"/>
 
@@ -446,14 +485,14 @@
             <exclusion groupId="org.slf4j" artifactId="slf4j-api"/>
           </dependency>
 	  -->
-          <dependency groupId="org.eclipse.jdt.core.compiler" artifactId="ecj" version="4.4.2" />
-          <dependency groupId="org.caffinitas.ohc" artifactId="ohc-core" version="0.4.4">
+          <dependency groupId="org.eclipse.jdt.core.compiler" artifactId="ecj" version="${ecj.version}" />
+          <dependency groupId="org.caffinitas.ohc" artifactId="ohc-core" version="${ohc.version}">
             <exclusion groupId="org.slf4j" artifactId="slf4j-api"/>
           </dependency>
-          <dependency groupId="org.caffinitas.ohc" artifactId="ohc-core-j8" version="0.4.4" />
+          <dependency groupId="org.caffinitas.ohc" artifactId="ohc-core-j8" version="${ohc.version}" />
           <dependency groupId="net.ju-n.compile-command-annotations" artifactId="compile-command-annotations" version="1.2.0" />
           <dependency groupId="org.fusesource" artifactId="sigar" version="1.6.4">
-          	<exclusion groupId="log4j" artifactId="log4j"/>
+            <exclusion groupId="log4j" artifactId="log4j"/>
           </dependency>
           <dependency groupId="joda-time" artifactId="joda-time" version="2.4" />
           <dependency groupId="com.carrotsearch" artifactId="hppc" version="0.5.4" />
@@ -462,7 +501,9 @@
           <dependency groupId="com.googlecode.concurrent-trees" artifactId="concurrent-trees" version="2.4.0" />
           <dependency groupId="com.github.ben-manes.caffeine" artifactId="caffeine" version="2.3.5" />
           <dependency groupId="org.jctools" artifactId="jctools-core" version="1.2.1"/>
-          <dependency groupId="org.ow2.asm" artifactId="asm" version="5.0.4" />
+          <dependency groupId="org.ow2.asm" artifactId="asm" version="${asm.version}" />
+          <dependency groupId="org.ow2.asm" artifactId="asm-tree" version="${asm.version}" />
+          <dependency groupId="org.ow2.asm" artifactId="asm-commons" version="${asm.version}" />
         </dependencyManagement>
         <developer id="adelapena" name="Andres de la Peña"/>
         <developer id="alakshman" name="Avinash Lakshman"/>
@@ -521,8 +562,8 @@
         <dependency groupId="org.psjava" artifactId="psjava" version="0.1.19" />
         <dependency groupId="org.apache.rat" artifactId="apache-rat"/>
         <dependency groupId="org.apache.hadoop" artifactId="hadoop-core"/>
-      	<dependency groupId="org.apache.hadoop" artifactId="hadoop-minicluster"/>
-      	<dependency groupId="com.google.code.findbugs" artifactId="jsr305"/>
+        <dependency groupId="org.apache.hadoop" artifactId="hadoop-minicluster"/>
+        <dependency groupId="com.google.code.findbugs" artifactId="jsr305"/>
         <dependency groupId="org.antlr" artifactId="antlr"/>
 	<!-- UPDATE AND UNCOMMENT ON THE DRIVER RELEASE, BEFORE 4.0 RELEASE
         <dependency groupId="com.datastax.cassandra" artifactId="cassandra-driver-core" classifier="shaded"/>
@@ -533,7 +574,7 @@
         <dependency groupId="org.openjdk.jmh" artifactId="jmh-core"/>
         <dependency groupId="org.openjdk.jmh" artifactId="jmh-generator-annprocess"/>
         <dependency groupId="net.ju-n.compile-command-annotations" artifactId="compile-command-annotations"/>
-        <dependency groupId="org.apache.ant" artifactId="ant-junit" version="1.9.4" />
+        <dependency groupId="org.apache.ant" artifactId="ant-junit" version="1.9.7" />
       </artifact:pom>
       <!-- this build-deps-pom-sources "artifact" is the same as build-deps-pom but only with those
            artifacts that have "-source.jar" files -->
@@ -552,7 +593,7 @@
         <dependency groupId="org.openjdk.jmh" artifactId="jmh-core"/>
         <dependency groupId="org.openjdk.jmh" artifactId="jmh-generator-annprocess"/>
         <dependency groupId="net.ju-n.compile-command-annotations" artifactId="compile-command-annotations"/>
-        <dependency groupId="org.apache.ant" artifactId="ant-junit" version="1.9.4" />
+        <dependency groupId="org.apache.ant" artifactId="ant-junit" version="1.9.7" />
       </artifact:pom>
 
       <artifact:pom id="coverage-deps-pom"
@@ -703,6 +744,14 @@
         </patternset>
         <mapper type="flatten"/>
       </unzip>
+
+      <!-- Need to delete some dependencies from build/lib/jars as non-matching versions may get in there
+      due to transitive dependencies -->
+      <delete>
+          <fileset dir="${build.dir.lib}/jars">
+              <include name="asm-*" />
+          </fileset>
+      </delete>
     </target>
 
     <target name="maven-ant-tasks-retrieve-test" depends="maven-ant-tasks-init">
@@ -737,16 +786,17 @@
       </propertyfile>
     </target>
 
-    <target name="test-run" depends="build"
+    <target name="test-run" depends="jar"
             description="Run in test mode.  Not for production use!">
       <java classname="org.apache.cassandra.service.CassandraDaemon" fork="true">
         <classpath>
-          <path refid="cassandra.classpath"/>
+          <path refid="cassandra.classpath.test"/>
           <pathelement location="${test.conf}"/>
         </classpath>
         <jvmarg value="-Dstorage-config=${test.conf}"/>
-        <jvmarg value="-javaagent:${basedir}/lib/jamm-0.3.0.jar" />
+        <jvmarg value="-javaagent:${basedir}/lib/jamm-${jamm.version}.jar" />
         <jvmarg value="-ea"/>
+        <jvmarg line="${java11-jvmargs}"/>
       </java>
     </target>
 
@@ -757,25 +807,63 @@
         depends="maven-ant-tasks-retrieve-build,build-project" description="Compile Cassandra classes"/>
     <target name="codecoverage" depends="jacoco-run,jacoco-report" description="Create code coverage report"/>
 
-    <target depends="init,gen-cql3-grammar,generate-cql-html,generate-jflex-java"
-            name="build-project">
-        <echo message="${ant.project.name}: ${ant.file}"/>
-        <!-- Order matters! -->
+    <target name="_build_java8_only" if="java.version.8">
+        <echo message="Compiling only for Java 8 ..."/>
         <javac fork="true"
                debug="true" debuglevel="${debuglevel}" encoding="utf-8"
-               destdir="${build.classes.main}" includeantruntime="false" source="${source.version}" target="${target.version}"
+               destdir="${build.classes.main}" includeantruntime="false" source="8" target="8"
                memorymaximumsize="512M">
             <src path="${build.src.java}"/>
+            <src path="${build.src.java8}"/>
             <src path="${build.src.gen-java}"/>
             <compilerarg value="-XDignore.symbol.file"/>
-            <compilerarg value="-Xbootclasspath/p:${build.src.jdkoverride}"/>
-            <classpath refid="cassandra.classpath"/>
+            <classpath>
+                <path refid="cassandra.classpath"/>
+            </classpath>
         </javac>
+    </target>
+    <target name="_build_multi_java" unless="java.version.8">
+        <!-- Note: we cannot use javac's 'release' option, as that does not allow accessing sun.misc.Unsafe nor
+        Nashorn's ClassFilter class as any javac modules option is invalid for relase 8. -->
+        <echo message="Compiling for Java 8 (using ${env.JAVA8_HOME}/bin/javac) ..."/>
+        <javac fork="true"
+               debug="true" debuglevel="${debuglevel}" encoding="utf-8"
+               destdir="${build.classes.main}" includeantruntime="false" source="8" target="8"
+               executable="${env.JAVA8_HOME}/bin/javac"
+               memorymaximumsize="512M">
+            <src path="${build.src.java}"/>
+            <src path="${build.src.java8}"/>
+            <src path="${build.src.gen-java}"/>
+            <compilerarg value="-XDignore.symbol.file"/>
+            <classpath>
+                <path refid="cassandra.classpath"/>
+            </classpath>
+        </javac>
+        <echo message="Compiling for current java version ..."/>
+        <javac fork="true"
+               debug="true" debuglevel="${debuglevel}" encoding="utf-8"
+               destdir="${build.classes.main}/META-INF/versions/11" includeantruntime="false"
+               memorymaximumsize="512M">
+            <src path="${build.src.java11}"/>
+            <compilerarg value="--release"/>
+            <compilerarg value="${release.version}"/>
+            <compilerarg value="-XDignore.symbol.file"/>
+            <classpath>
+                <path refid="cassandra.classpath"/>
+            </classpath>
+        </javac>
+    </target>
+    <target depends="init,gen-cql3-grammar,generate-cql-html,generate-jflex-java"
+            name="build-project">
+        <echo message="${ant.project.name}: ${ant.file}"/>
+        <!-- Order matters! -->
+        <antcall target="_build_java8_only"/>
+        <antcall target="_build_multi_java"/>
         <antcall target="createVersionPropFile"/>
         <copy todir="${build.classes.main}">
             <fileset dir="${build.src.resources}" />
         </copy>
-	<copy todir="${basedir}/conf" file="${build.classes.main}/META-INF/hotspot_compiler"/>
+        <copy todir="${basedir}/conf" file="${build.classes.main}/META-INF/hotspot_compiler"/>
     </target>
 
     <!-- Stress build file -->
@@ -790,10 +878,8 @@
 
     <target name="stress-build-test" depends="stress-build" description="Compile stress tests">
         <javac debug="true" debuglevel="${debuglevel}" destdir="${stress.test.classes}"
-               includeantruntime="false"
-               source="${source.version}"
-               target="${target.version}"
-               encoding="utf-8">
+               source="${source.version}" target="${target.version}"
+               includeantruntime="false" encoding="utf-8">
             <classpath>
                 <path refid="cassandra.classpath"/>
                 <pathelement location="${stress.build.classes}" />
@@ -804,7 +890,9 @@
 
     <target name="stress-build" depends="build" description="build stress tool">
     	<mkdir dir="${stress.build.classes}" />
-        <javac compiler="modern" debug="true" debuglevel="${debuglevel}" encoding="utf-8" destdir="${stress.build.classes}" includeantruntime="true" source="${source.version}" target="${target.version}">
+        <javac compiler="modern" debug="true" debuglevel="${debuglevel}"
+               source="${source.version}" target="${target.version}"
+               encoding="utf-8" destdir="${stress.build.classes}" includeantruntime="true">
             <src path="${stress.build.src}" />
             <classpath>
                 <path refid="cassandra.classes" />
@@ -838,8 +926,8 @@
     <!--
         The jar target makes cassandra.jar output.
     -->
-    <target name="jar"
-            depends="build, build-test, stress-build, write-poms"
+    <target name="_main-jar"
+            depends="build"
             description="Assemble Cassandra JAR files">
       <mkdir dir="${build.classes.main}/META-INF" />
       <copy file="LICENSE.txt"
@@ -853,15 +941,17 @@
         </fileset>
         <manifest>
         <!-- <section name="org/apache/cassandra/infrastructure"> -->
+          <attribute name="Multi-Release" value="true"/>
           <attribute name="Implementation-Title" value="Cassandra"/>
           <attribute name="Implementation-Version" value="${version}"/>
           <attribute name="Implementation-Vendor" value="Apache"/>
-          <attribute name="Premain-Class"
-                     value="org.apache.cassandra.infrastructure.continuations.CAgent"/>
         <!-- </section> -->
         </manifest>
       </jar>
-
+    </target>
+    <target name="jar"
+            depends="_main-jar, build-test, stress-build, write-poms"
+            description="Assemble Cassandra JAR files">
       <!-- Stress jar -->
       <manifest file="${stress.manifest}">
         <attribute name="Built-By" value="Pavel Yaskevich"/>
@@ -884,6 +974,9 @@
           <fileset dir="${build.src.java}" defaultexcludes="yes">
             <include name="org/apache/**/*.java"/>
           </fileset>
+          <fileset dir="${build.src.java11}" defaultexcludes="yes">
+            <include name="org/apache/**/*.java"/>
+          </fileset>
           <fileset dir="${build.src.gen-java}" defaultexcludes="yes">
             <include name="org/apache/**/*.java"/>
           </fileset>
@@ -905,6 +998,9 @@
         <fileset dir="${build.src.java}" defaultexcludes="yes">
           <include name="org/apache/**/*.java"/>
         </fileset>
+        <fileset dir="${build.src.java11}" defaultexcludes="yes">
+          <include name="org/apache/**/*.java"/>
+        </fileset>
         <fileset dir="${build.src.gen-java}" defaultexcludes="yes">
           <include name="org/apache/**/*.java"/>
         </fileset>
@@ -913,6 +1009,7 @@
 
     <!-- creates release tarballs -->
     <target name="artifacts" depends="jar,javadoc,gen-doc"
+            unless="java.version.8"
             description="Create Cassandra release artifacts">
       <mkdir dir="${dist.dir}"/>
       <!-- fix the control linefeed so that builds on windows works on linux -->
@@ -1058,7 +1155,7 @@
       </rat:report>
     </target>
 
-  <target name="build-jmh" depends="build-test" description="Create JMH uber jar">
+  <target name="build-jmh" depends="build-test, jar" description="Create JMH uber jar">
       <jar jarfile="${build.test.dir}/deps.jar">
           <zipgroupfileset dir="${build.dir.lib}/jars">
               <include name="*jmh*.jar"/>
@@ -1081,7 +1178,7 @@
     <!-- use https://github.com/krummas/jstackjunit to get thread dumps when unit tests time out -->
   <taskdef name="junit" classname="org.krummas.junit.JStackJUnitTask" classpath="lib/jstackjunit-0.0.1.jar"/>
 
-  <target name="build-test" depends="build" description="Compile test classes">
+  <target name="build-test" depends="_main-jar, stress-build, write-poms" description="Compile test classes">
     <javac
      compiler="modern"
      debug="true"
@@ -1139,7 +1236,7 @@
         <jvmarg value="-Dstorage-config=${test.conf}"/>
         <jvmarg value="-Djava.awt.headless=true"/>
         <!-- Cassandra 3.0+ needs <jvmarg line="... ${additionalagent}" /> here! (not value=) -->
-        <jvmarg line="-javaagent:${basedir}/lib/jamm-0.3.0.jar ${additionalagent}" />
+        <jvmarg line="-javaagent:${basedir}/lib/jamm-${jamm.version}.jar ${additionalagent}" />
         <jvmarg value="-ea"/>
         <jvmarg value="-Dcassandra.debugrefcount=true"/>
         <jvmarg value="-Xss256k"/>
@@ -1151,6 +1248,7 @@
         <jvmarg value="-Djava.security.egd=file:/dev/urandom" />
         <jvmarg value="-Dcassandra.testtag=@{testtag}"/>
         <jvmarg value="-Dcassandra.keepBriefBrief=${cassandra.keepBriefBrief}" />
+        <jvmarg line="${java11-jvmargs}"/>
         <optjvmargs/>
         <!-- Uncomment to debug unittest, attach debugger to port 1416 -->
         <!--
@@ -1159,7 +1257,7 @@
         <classpath>
           <pathelement path="${java.class.path}"/>
           <pathelement location="${stress.build.classes}"/>
-          <path refid="cassandra.classpath" />
+          <path refid="cassandra.classpath.test" />
           <pathelement location="${test.classes}"/>
           <pathelement location="${stress.test.classes}"/>
           <pathelement location="${test.conf}"/>
@@ -1189,7 +1287,7 @@
     </sequential>
   </macrodef>
 
-  <target name="testold" depends="build-test" description="Execute unit tests">
+    <target name="testold" depends="build-test" description="Execute unit tests">
     <testmacro inputdir="${test.unit.src}" timeout="${test.timeout}">
       <jvmarg value="-Dlegacy-sstable-root=${test.data}/legacy-sstables"/>
       <jvmarg value="-Dinvalid-legacy-sstable-root=${test.data}/invalid-legacy-sstables"/>
@@ -1294,7 +1392,7 @@
     </testmacro>
   </target>
 
-  <target name="test-compression" depends="build-test,stress-build" description="Execute unit tests with sstable compression enabled">
+  <target name="test-compression" depends="build-test, stress-build" description="Execute unit tests with sstable compression enabled">
     <property name="compressed_yaml" value="${build.test.dir}/cassandra.compressed.yaml"/>
     <concat destfile="${compressed_yaml}">
       <fileset file="${test.conf}/cassandra.yaml"/>
@@ -1369,14 +1467,14 @@
         <formatter type="brief" usefile="false"/>
         <jvmarg value="-Dstorage-config=${test.conf}"/>
         <jvmarg value="-Djava.awt.headless=true"/>
-        <jvmarg value="-javaagent:${basedir}/lib/jamm-0.3.0.jar" />
+        <jvmarg value="-javaagent:${basedir}/lib/jamm-${jamm.version}.jar" />
         <jvmarg value="-ea"/>
         <jvmarg value="-Xss256k"/>
         <jvmarg value="-Dcassandra.memtable_row_overhead_computation_step=100"/>
         <jvmarg value="-Dcassandra.test.use_prepared=${cassandra.test.use_prepared}"/>
         <jvmarg value="-Dcassandra.skip_sync=true" />
         <classpath>
-          <path refid="cassandra.classpath" />
+          <path refid="cassandra.classpath.test" />
           <pathelement location="${test.classes}"/>
           <pathelement location="${test.conf}"/>
           <fileset dir="${test.lib}">
@@ -1411,14 +1509,14 @@
         <formatter type="brief" usefile="false"/>
         <jvmarg value="-Dstorage-config=${test.conf}"/>
         <jvmarg value="-Djava.awt.headless=true"/>
-        <jvmarg value="-javaagent:${basedir}/lib/jamm-0.3.0.jar" />
+        <jvmarg value="-javaagent:${basedir}/lib/jamm-${jamm.version}.jar" />
         <jvmarg value="-ea"/>
         <jvmarg value="-Xss256k"/>
         <jvmarg value="-Dcassandra.test.use_prepared=${cassandra.test.use_prepared}"/>
         <jvmarg value="-Dcassandra.memtable_row_overhead_computation_step=100"/>
         <jvmarg value="-Dcassandra.skip_sync=true" />
         <classpath>
-          <path refid="cassandra.classpath" />
+          <path refid="cassandra.classpath.test" />
           <pathelement location="${test.classes}"/>
           <pathelement location="${test.conf}"/>
           <fileset dir="${test.lib}">
@@ -1665,7 +1763,7 @@
     <echo message="Mem size : ${mem.size}"/>
   </target>
 
-  <target name="test" depends="build-test,get-cores,get-mem,stress-build" description="Parallel Test Runner">
+  <target name="test" depends="build-test,get-cores,get-mem" description="Parallel Test Runner">
     <path id="all-test-classes-path">
       <fileset dir="${test.unit.src}" includes="**/${test.name}.java" />
     </path>
@@ -1684,13 +1782,13 @@
     <testparallel testdelegate="testlist"/>
   </target>
 
-  <!-- run microbenchmarks suite -->
+    <!-- run microbenchmarks suite -->
   <target name="microbench" depends="build-jmh">
       <java classname="org.openjdk.jmh.Main"
             fork="true"
             failonerror="true">
           <classpath>
-              <path refid="cassandra.classpath" />
+              <path refid="cassandra.classpath.test" />
               <pathelement location="${test.classes}"/>
               <pathelement location="${test.conf}"/>
               <fileset dir="${test.lib}">
@@ -1708,6 +1806,7 @@
     <copy todir=".idea">
         <fileset dir="ide/idea"/>
     </copy>
+    <replace file=".idea/workspace.xml" token="trunk" value="${eclipse.project.name}"/>
     <copy tofile="${eclipse.project.name}.iml" file="ide/idea-iml-file.xml"/>
     <echo file=".idea/.name">Apache Cassandra ${eclipse.project.name}</echo>
     <echo file=".idea/modules.xml"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
@@ -1808,7 +1907,8 @@
   </target>
 
 
-  <target name="eclipse-warnings" depends="build" description="Run eclipse compiler code analysis">
+  <!-- ECJ 4.6.1 in standalone mode does not work with JPMS, so we skip this target for Java 11 -->
+  <target name="eclipse-warnings" depends="build" description="Run eclipse compiler code analysis" if="java.version.8">
         <property name="ecj.log.dir" value="${build.dir}/ecj" />
         <property name="ecj.warnings.file" value="${ecj.log.dir}/eclipse_compiler_checks.txt"/>
         <mkdir  dir="${ecj.log.dir}" />

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6ba2fb93/conf/cassandra-env.ps1
----------------------------------------------------------------------
diff --git a/conf/cassandra-env.ps1 b/conf/cassandra-env.ps1
index f17d265..8ba8a5a 100644
--- a/conf/cassandra-env.ps1
+++ b/conf/cassandra-env.ps1
@@ -380,11 +380,7 @@ Function SetCassandraEnvironment
     $env:JVM_OPTS = "$env:JVM_OPTS -XX:CompileCommandFile=""$env:CASSANDRA_CONF\hotspot_compiler"""
 
     # add the jamm javaagent
-    if (($env:JVM_VENDOR -ne "OpenJDK") -or ($env:JVM_VERSION.CompareTo("1.6.0") -eq 1) -or
-        (($env:JVM_VERSION -eq "1.6.0") -and ($env:JVM_PATCH_VERSION.CompareTo("22") -eq 1)))
-    {
-        $env:JVM_OPTS = "$env:JVM_OPTS -javaagent:""$env:CASSANDRA_HOME\lib\jamm-0.3.0.jar"""
-    }
+    $env:JVM_OPTS = "$env:JVM_OPTS -javaagent:""$env:CASSANDRA_HOME\lib\jamm-0.3.2.jar"""
 
     # set jvm HeapDumpPath with CASSANDRA_HEAPDUMP_DIR
     if ($env:CASSANDRA_HEAPDUMP_DIR)
@@ -403,9 +399,10 @@ Function SetCassandraEnvironment
     # print an heap histogram on OutOfMemoryError
     # $env:JVM_OPTS="$env:JVM_OPTS -Dcassandra.printHeapHistogramOnOutOfMemoryError=true"
 
-    if ($env:JVM_VERSION.CompareTo("1.8.0") -eq -1 -or [convert]::ToInt32($env:JVM_PATCH_VERSION) -lt 40)
+    $env:JAVA_VERSION=11
+    if ($env:JVM_VERSION.CompareTo("1.8.0") -eq -1 -or [convert]::ToInt32($env:JVM_PATCH_VERSION) -lt 151)
     {
-        echo "Cassandra 3.0 and later require Java 8u40 or later."
+        echo "Cassandra 4.0 requires either Java 8 (update 151 or newer) or Java 11 (or newer). Java $env:JVM_VERSION is not supported."
         exit
     }
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6ba2fb93/conf/cassandra-env.sh
----------------------------------------------------------------------
diff --git a/conf/cassandra-env.sh b/conf/cassandra-env.sh
index 3ccb1e1..dc30437 100644
--- a/conf/cassandra-env.sh
+++ b/conf/cassandra-env.sh
@@ -86,55 +86,27 @@ calculate_heap_sizes()
     fi
 }
 
-# Determine the sort of JVM we'll be running on.
-java_ver_output=`"${JAVA:-java}" -version 2>&1`
-jvmver=`echo "$java_ver_output" | grep '[openjdk|java] version' | awk -F'"' 'NR==1 {print $2}' | cut -d\- -f1`
-JVM_VERSION=${jvmver%_*}
-JVM_PATCH_VERSION=${jvmver#*_}
-
-if [ "$JVM_VERSION" \< "1.8" ] ; then
-    echo "Cassandra 3.0 and later require Java 8u40 or later."
-    exit 1;
-fi
-
-if [ "$JVM_VERSION" \< "1.8" ] && [ "$JVM_PATCH_VERSION" -lt 40 ] ; then
-    echo "Cassandra 3.0 and later require Java 8u40 or later."
-    exit 1;
-fi
-
-jvm=`echo "$java_ver_output" | grep -A 1 '[openjdk|java] version' | awk 'NR==2 {print $1}'`
-case "$jvm" in
-    OpenJDK)
-        JVM_VENDOR=OpenJDK
-        # this will be "64-Bit" or "32-Bit"
-        JVM_ARCH=`echo "$java_ver_output" | awk 'NR==3 {print $2}'`
-        ;;
-    "Java(TM)")
-        JVM_VENDOR=Oracle
-        # this will be "64-Bit" or "32-Bit"
-        JVM_ARCH=`echo "$java_ver_output" | awk 'NR==3 {print $3}'`
-        ;;
-    *)
-        # Help fill in other JVM values
-        JVM_VENDOR=other
-        JVM_ARCH=unknown
-        ;;
-esac
-
 #GC log path has to be defined here because it needs to access CASSANDRA_HOME
-JVM_OPTS="$JVM_OPTS -Xloggc:${CASSANDRA_HOME}/logs/gc.log"
-
-# Here we create the arguments that will get passed to the jvm when
-# starting cassandra.
-
-# Read user-defined JVM options from jvm.options file
-JVM_OPTS_FILE=$CASSANDRA_CONF/jvm.options
-for opt in `grep "^-" $JVM_OPTS_FILE`
-do
-  JVM_OPTS="$JVM_OPTS $opt"
-done
+if [ $JAVA_VERSION -ge 11 ] ; then
+    # See description of https://bugs.openjdk.java.net/browse/JDK-8046148 for details about the syntax
+    # The following is the equivalent to -XX:+PrintGCDetails -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=10M
+    echo "$JVM_OPTS" | grep -q "^-[X]log:gc"
+    if [ "$?" = "1" ] ; then # [X] to prevent ccm from replacing this line
+        # only add -Xlog:gc if it's not mentioned in jvm-server.options file
+        mkdir -p ${CASSANDRA_HOME}/logs
+        JVM_OPTS="$JVM_OPTS -Xlog:gc=info,heap*=trace,age*=debug,safepoint=info,promotion*=trace:file=${CASSANDRA_HOME}/logs/gc.log:time,uptime,pid,tid,level:filecount=10,filesize=10485760"
+    fi
+else
+    # Java 8
+    echo "$JVM_OPTS" | grep -q "^-[X]loggc"
+    if [ "$?" = "1" ] ; then # [X] to prevent ccm from replacing this line
+        # only add -Xlog:gc if it's not mentioned in jvm-server.options file
+        mkdir -p ${CASSANDRA_HOME}/logs
+        JVM_OPTS="$JVM_OPTS -Xloggc:${CASSANDRA_HOME}/logs/gc.log"
+    fi
+fi
 
-# Check what parameters were defined on jvm.options file to avoid conflicts
+# Check what parameters were defined on jvm-server.options file to avoid conflicts
 echo $JVM_OPTS | grep -q Xmn
 DEFINED_XMN=$?
 echo $JVM_OPTS | grep -q Xmx
@@ -179,21 +151,21 @@ if [ "x$MALLOC_ARENA_MAX" = "x" ] ; then
     export MALLOC_ARENA_MAX=4
 fi
 
-# We only set -Xms and -Xmx if they were not defined on jvm.options file
+# We only set -Xms and -Xmx if they were not defined on jvm-server.options file
 # If defined, both Xmx and Xms should be defined together.
 if [ $DEFINED_XMX -ne 0 ] && [ $DEFINED_XMS -ne 0 ]; then
      JVM_OPTS="$JVM_OPTS -Xms${MAX_HEAP_SIZE}"
      JVM_OPTS="$JVM_OPTS -Xmx${MAX_HEAP_SIZE}"
 elif [ $DEFINED_XMX -ne 0 ] || [ $DEFINED_XMS -ne 0 ]; then
-     echo "Please set or unset -Xmx and -Xms flags in pairs on jvm.options file."
+     echo "Please set or unset -Xmx and -Xms flags in pairs on jvm-server.options file."
      exit 1
 fi
 
-# We only set -Xmn flag if it was not defined in jvm.options file
+# We only set -Xmn flag if it was not defined in jvm-server.options file
 # and if the CMS GC is being used
 # If defined, both Xmn and Xmx should be defined together.
 if [ $DEFINED_XMN -eq 0 ] && [ $DEFINED_XMX -ne 0 ]; then
-    echo "Please set or unset -Xmx and -Xmn flags in pairs on jvm.options file."
+    echo "Please set or unset -Xmx and -Xmn flags in pairs on jvm-server.options file."
     exit 1
 elif [ $DEFINED_XMN -ne 0 ] && [ $USING_CMS -eq 0 ]; then
     JVM_OPTS="$JVM_OPTS -Xmn${HEAP_NEWSIZE}"
@@ -207,7 +179,7 @@ fi
 JVM_OPTS="$JVM_OPTS -XX:CompileCommandFile=$CASSANDRA_CONF/hotspot_compiler"
 
 # add the jamm javaagent
-JVM_OPTS="$JVM_OPTS -javaagent:$CASSANDRA_HOME/lib/jamm-0.3.0.jar"
+JVM_OPTS="$JVM_OPTS -javaagent:$CASSANDRA_HOME/lib/jamm-0.3.2.jar"
 
 # set jvm HeapDumpPath with CASSANDRA_HEAPDUMP_DIR
 if [ "x$CASSANDRA_HEAPDUMP_DIR" != "x" ]; then

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6ba2fb93/conf/jvm-clients.options
----------------------------------------------------------------------
diff --git a/conf/jvm-clients.options b/conf/jvm-clients.options
new file mode 100644
index 0000000..6181ed0
--- /dev/null
+++ b/conf/jvm-clients.options
@@ -0,0 +1,10 @@
+###########################################################################
+#                         jvm-clients.options                             #
+#                                                                         #
+# See jvm8-clients.options and jvm11-clients.options for Java version     #
+# specific options.                                                       #
+###########################################################################
+
+# intentionally left empty
+
+# The newline in the end of file is intentional

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6ba2fb93/conf/jvm-server.options
----------------------------------------------------------------------
diff --git a/conf/jvm-server.options b/conf/jvm-server.options
new file mode 100644
index 0000000..c52e192
--- /dev/null
+++ b/conf/jvm-server.options
@@ -0,0 +1,191 @@
+###########################################################################
+#                         jvm-server.options                              #
+#                                                                         #
+# - all flags defined here will be used by cassandra to startup the JVM   #
+# - one flag should be specified per line                                 #
+# - lines that do not start with '-' will be ignored                      #
+# - only static flags are accepted (no variables or parameters)           #
+# - dynamic flags will be appended to these on cassandra-env              #
+#                                                                         #
+# See jvm8-server.options and jvm11-server.options for Java version       #
+# specific options.                                                       #
+###########################################################################
+
+######################
+# STARTUP PARAMETERS #
+######################
+
+# Uncomment any of the following properties to enable specific startup parameters
+
+# In a multi-instance deployment, multiple Cassandra instances will independently assume that all
+# CPU processors are available to it. This setting allows you to specify a smaller set of processors
+# and perhaps have affinity.
+#-Dcassandra.available_processors=number_of_processors
+
+# The directory location of the cassandra.yaml file.
+#-Dcassandra.config=directory
+
+# Sets the initial partitioner token for a node the first time the node is started.
+#-Dcassandra.initial_token=token
+
+# Set to false to start Cassandra on a node but not have the node join the cluster.
+#-Dcassandra.join_ring=true|false
+
+# Set to false to clear all gossip state for the node on restart. Use when you have changed node
+# information in cassandra.yaml (such as listen_address).
+#-Dcassandra.load_ring_state=true|false
+
+# Enable pluggable metrics reporter. See Pluggable metrics reporting in Cassandra 2.0.2.
+#-Dcassandra.metricsReporterConfigFile=file
+
+# Set the port on which the CQL native transport listens for clients. (Default: 9042)
+#-Dcassandra.native_transport_port=port
+
+# Overrides the partitioner. (Default: org.apache.cassandra.dht.Murmur3Partitioner)
+#-Dcassandra.partitioner=partitioner
+
+# To replace a node that has died, restart a new node in its place specifying the address of the
+# dead node. The new node must not have any data in its data directory, that is, it must be in the
+# same state as before bootstrapping.
+#-Dcassandra.replace_address=listen_address or broadcast_address of dead node
+
+# Allow restoring specific tables from an archived commit log.
+#-Dcassandra.replayList=table
+
+# Allows overriding of the default RING_DELAY (30000ms), which is the amount of time a node waits
+# before joining the ring.
+#-Dcassandra.ring_delay_ms=ms
+
+# Set the SSL port for encrypted communication. (Default: 7001)
+#-Dcassandra.ssl_storage_port=port
+
+# Set the port for inter-node communication. (Default: 7000)
+#-Dcassandra.storage_port=port
+
+# Set the default location for the trigger JARs. (Default: conf/triggers)
+#-Dcassandra.triggers_dir=directory
+
+# For testing new compaction and compression strategies. It allows you to experiment with different
+# strategies and benchmark write performance differences without affecting the production workload. 
+#-Dcassandra.write_survey=true
+
+# To disable configuration via JMX of auth caches (such as those for credentials, permissions and
+# roles). This will mean those config options can only be set (persistently) in cassandra.yaml
+# and will require a restart for new values to take effect.
+#-Dcassandra.disable_auth_caches_remote_configuration=true
+
+# To disable dynamic calculation of the page size used when indexing an entire partition (during
+# initial index build/rebuild). If set to true, the page size will be fixed to the default of
+# 10000 rows per page.
+#-Dcassandra.force_default_indexing_page_size=true
+
+# Imposes an upper bound on hint lifetime below the normal min gc_grace_seconds
+#-Dcassandra.maxHintTTL=max_hint_ttl_in_seconds
+
+########################
+# GENERAL JVM SETTINGS #
+########################
+
+# enable assertions. highly suggested for correct application functionality.
+-ea
+
+# disable assertions for net.openhft.** because it runs out of memory by design
+# if enabled and run for more than just brief testing
+-da:net.openhft...
+
+# enable thread priorities, primarily so we can give periodic tasks
+# a lower priority to avoid interfering with client workload
+-XX:+UseThreadPriorities
+
+# Enable heap-dump if there's an OOM
+-XX:+HeapDumpOnOutOfMemoryError
+
+# Per-thread stack size.
+-Xss256k
+
+# Larger interned string table, for gossip's benefit (CASSANDRA-6410)
+-XX:StringTableSize=1000003
+
+# Make sure all memory is faulted and zeroed on startup.
+# This helps prevent soft faults in containers and makes
+# transparent hugepage allocation more effective.
+-XX:+AlwaysPreTouch
+
+# Disable biased locking as it does not benefit Cassandra.
+-XX:-UseBiasedLocking
+
+# Enable thread-local allocation blocks and allow the JVM to automatically
+# resize them at runtime.
+-XX:+UseTLAB
+-XX:+ResizeTLAB
+-XX:+UseNUMA
+
+# http://www.evanjones.ca/jvm-mmap-pause.html
+-XX:+PerfDisableSharedMem
+
+# Prefer binding to IPv4 network intefaces (when net.ipv6.bindv6only=1). See
+# http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6342561 (short version:
+# comment out this entry to enable IPv6 support).
+-Djava.net.preferIPv4Stack=true
+
+### Debug options
+
+# uncomment to enable flight recorder
+#-XX:+UnlockCommercialFeatures
+#-XX:+FlightRecorder
+
+# uncomment to have Cassandra JVM listen for remote debuggers/profilers on port 1414
+#-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=1414
+
+# uncomment to have Cassandra JVM log internal method compilation (developers only)
+#-XX:+UnlockDiagnosticVMOptions
+#-XX:+LogCompilation
+
+#################
+# HEAP SETTINGS #
+#################
+
+# Heap size is automatically calculated by cassandra-env based on this
+# formula: max(min(1/2 ram, 1024MB), min(1/4 ram, 8GB))
+# That is:
+# - calculate 1/2 ram and cap to 1024MB
+# - calculate 1/4 ram and cap to 8192MB
+# - pick the max
+#
+# For production use you may wish to adjust this for your environment.
+# If that's the case, uncomment the -Xmx and Xms options below to override the
+# automatic calculation of JVM heap memory.
+#
+# It is recommended to set min (-Xms) and max (-Xmx) heap sizes to
+# the same value to avoid stop-the-world GC pauses during resize, and
+# so that we can lock the heap in memory on startup to prevent any
+# of it from being swapped out.
+#-Xms4G
+#-Xmx4G
+
+# Young generation size is automatically calculated by cassandra-env
+# based on this formula: min(100 * num_cores, 1/4 * heap size)
+#
+# The main trade-off for the young generation is that the larger it
+# is, the longer GC pause times will be. The shorter it is, the more
+# expensive GC will be (usually).
+#
+# It is not recommended to set the young generation size if using the
+# G1 GC, since that will override the target pause-time goal.
+# More info: http://www.oracle.com/technetwork/articles/java/g1gc-1984535.html
+#
+# The example below assumes a modern 8-core+ machine for decent
+# times. If in doubt, and if you do not particularly want to tweak, go
+# 100 MB per physical CPU core.
+#-Xmn800M
+
+###################################
+# EXPIRATION DATE OVERFLOW POLICY #
+###################################
+
+# Defines how to handle INSERT requests with TTL exceeding the maximum supported expiration date:
+# * REJECT: this is the default policy and will reject any requests with expiration date timestamp after 2038-01-19T03:14:06+00:00.
+# * CAP: any insert with TTL expiring after 2038-01-19T03:14:06+00:00 will expire on 2038-01-19T03:14:06+00:00 and the client will receive a warning.
+# * CAP_NOWARN: same as previous, except that the client warning will not be emitted.
+#
+#-Dcassandra.expiration_date_overflow_policy=REJECT

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6ba2fb93/conf/jvm.options
----------------------------------------------------------------------
diff --git a/conf/jvm.options b/conf/jvm.options
deleted file mode 100644
index ac9834f..0000000
--- a/conf/jvm.options
+++ /dev/null
@@ -1,254 +0,0 @@
-###########################################################################
-#                             jvm.options                                 #
-#                                                                         #
-# - all flags defined here will be used by cassandra to startup the JVM   #
-# - one flag should be specified per line                                 #
-# - lines that do not start with '-' will be ignored                      #
-# - only static flags are accepted (no variables or parameters)           #
-# - dynamic flags will be appended to these on cassandra-env              #
-###########################################################################
-
-######################
-# STARTUP PARAMETERS #
-######################
-
-# Uncomment any of the following properties to enable specific startup parameters
-
-# In a multi-instance deployment, multiple Cassandra instances will independently assume that all
-# CPU processors are available to it. This setting allows you to specify a smaller set of processors
-# and perhaps have affinity.
-#-Dcassandra.available_processors=number_of_processors
-
-# The directory location of the cassandra.yaml file.
-#-Dcassandra.config=directory
-
-# Sets the initial partitioner token for a node the first time the node is started.
-#-Dcassandra.initial_token=token
-
-# Set to false to start Cassandra on a node but not have the node join the cluster.
-#-Dcassandra.join_ring=true|false
-
-# Set to false to clear all gossip state for the node on restart. Use when you have changed node
-# information in cassandra.yaml (such as listen_address).
-#-Dcassandra.load_ring_state=true|false
-
-# Enable pluggable metrics reporter. See Pluggable metrics reporting in Cassandra 2.0.2.
-#-Dcassandra.metricsReporterConfigFile=file
-
-# Set the port on which the CQL native transport listens for clients. (Default: 9042)
-#-Dcassandra.native_transport_port=port
-
-# Overrides the partitioner. (Default: org.apache.cassandra.dht.Murmur3Partitioner)
-#-Dcassandra.partitioner=partitioner
-
-# To replace a node that has died, restart a new node in its place specifying the address of the
-# dead node. The new node must not have any data in its data directory, that is, it must be in the
-# same state as before bootstrapping.
-#-Dcassandra.replace_address=listen_address or broadcast_address of dead node
-
-# Allow restoring specific tables from an archived commit log.
-#-Dcassandra.replayList=table
-
-# Allows overriding of the default RING_DELAY (30000ms), which is the amount of time a node waits
-# before joining the ring.
-#-Dcassandra.ring_delay_ms=ms
-
-# Set the SSL port for encrypted communication. (Default: 7001)
-#-Dcassandra.ssl_storage_port=port
-
-# Set the port for inter-node communication. (Default: 7000)
-#-Dcassandra.storage_port=port
-
-# Set the default location for the trigger JARs. (Default: conf/triggers)
-#-Dcassandra.triggers_dir=directory
-
-# For testing new compaction and compression strategies. It allows you to experiment with different
-# strategies and benchmark write performance differences without affecting the production workload. 
-#-Dcassandra.write_survey=true
-
-# To disable configuration via JMX of auth caches (such as those for credentials, permissions and
-# roles). This will mean those config options can only be set (persistently) in cassandra.yaml
-# and will require a restart for new values to take effect.
-#-Dcassandra.disable_auth_caches_remote_configuration=true
-
-# To disable dynamic calculation of the page size used when indexing an entire partition (during
-# initial index build/rebuild). If set to true, the page size will be fixed to the default of
-# 10000 rows per page.
-#-Dcassandra.force_default_indexing_page_size=true
-
-# Imposes an upper bound on hint lifetime below the normal min gc_grace_seconds
-#-Dcassandra.maxHintTTL=max_hint_ttl_in_seconds
-
-########################
-# GENERAL JVM SETTINGS #
-########################
-
-# enable assertions. highly suggested for correct application functionality.
--ea
-
-# disable assertions for net.openhft.** because it runs out of memory by design
-# if enabled and run for more than just brief testing
--da:net.openhft...
-
-# enable thread priorities, primarily so we can give periodic tasks
-# a lower priority to avoid interfering with client workload
--XX:+UseThreadPriorities
-
-# allows lowering thread priority without being root on linux - probably
-# not necessary on Windows but doesn't harm anything.
-# see http://tech.stolsvik.com/2010/01/linux-java-thread-priorities-workaround.html
--XX:ThreadPriorityPolicy=42
-
-# Enable heap-dump if there's an OOM
--XX:+HeapDumpOnOutOfMemoryError
-
-# Per-thread stack size.
--Xss256k
-
-# Larger interned string table, for gossip's benefit (CASSANDRA-6410)
--XX:StringTableSize=1000003
-
-# Make sure all memory is faulted and zeroed on startup.
-# This helps prevent soft faults in containers and makes
-# transparent hugepage allocation more effective.
--XX:+AlwaysPreTouch
-
-# Disable biased locking as it does not benefit Cassandra.
--XX:-UseBiasedLocking
-
-# Enable thread-local allocation blocks and allow the JVM to automatically
-# resize them at runtime.
--XX:+UseTLAB
--XX:+ResizeTLAB
--XX:+UseNUMA
-
-# http://www.evanjones.ca/jvm-mmap-pause.html
--XX:+PerfDisableSharedMem
-
-# Prefer binding to IPv4 network intefaces (when net.ipv6.bindv6only=1). See
-# http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6342561 (short version:
-# comment out this entry to enable IPv6 support).
--Djava.net.preferIPv4Stack=true
-
-### Debug options
-
-# uncomment to enable flight recorder
-#-XX:+UnlockCommercialFeatures
-#-XX:+FlightRecorder
-
-# uncomment to have Cassandra JVM listen for remote debuggers/profilers on port 1414
-#-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=1414
-
-# uncomment to have Cassandra JVM log internal method compilation (developers only)
-#-XX:+UnlockDiagnosticVMOptions
-#-XX:+LogCompilation
-
-#################
-# HEAP SETTINGS #
-#################
-
-# Heap size is automatically calculated by cassandra-env based on this
-# formula: max(min(1/2 ram, 1024MB), min(1/4 ram, 8GB))
-# That is:
-# - calculate 1/2 ram and cap to 1024MB
-# - calculate 1/4 ram and cap to 8192MB
-# - pick the max
-#
-# For production use you may wish to adjust this for your environment.
-# If that's the case, uncomment the -Xmx and Xms options below to override the
-# automatic calculation of JVM heap memory.
-#
-# It is recommended to set min (-Xms) and max (-Xmx) heap sizes to
-# the same value to avoid stop-the-world GC pauses during resize, and
-# so that we can lock the heap in memory on startup to prevent any
-# of it from being swapped out.
-#-Xms4G
-#-Xmx4G
-
-# Young generation size is automatically calculated by cassandra-env
-# based on this formula: min(100 * num_cores, 1/4 * heap size)
-#
-# The main trade-off for the young generation is that the larger it
-# is, the longer GC pause times will be. The shorter it is, the more
-# expensive GC will be (usually).
-#
-# It is not recommended to set the young generation size if using the
-# G1 GC, since that will override the target pause-time goal.
-# More info: http://www.oracle.com/technetwork/articles/java/g1gc-1984535.html
-#
-# The example below assumes a modern 8-core+ machine for decent
-# times. If in doubt, and if you do not particularly want to tweak, go
-# 100 MB per physical CPU core.
-#-Xmn800M
-
-###################################
-# EXPIRATION DATE OVERFLOW POLICY #
-###################################
-
-# Defines how to handle INSERT requests with TTL exceeding the maximum supported expiration date:
-# * REJECT: this is the default policy and will reject any requests with expiration date timestamp after 2038-01-19T03:14:06+00:00.
-# * CAP: any insert with TTL expiring after 2038-01-19T03:14:06+00:00 will expire on 2038-01-19T03:14:06+00:00 and the client will receive a warning.
-# * CAP_NOWARN: same as previous, except that the client warning will not be emitted.
-#
-#-Dcassandra.expiration_date_overflow_policy=REJECT
-
-#################
-#  GC SETTINGS  #
-#################
-
-### CMS Settings
-
--XX:+UseParNewGC
--XX:+UseConcMarkSweepGC
--XX:+CMSParallelRemarkEnabled
--XX:SurvivorRatio=8
--XX:MaxTenuringThreshold=1
--XX:CMSInitiatingOccupancyFraction=75
--XX:+UseCMSInitiatingOccupancyOnly
--XX:CMSWaitDuration=10000
--XX:+CMSParallelInitialMarkEnabled
--XX:+CMSEdenChunksRecordAlways
-# some JVMs will fill up their heap when accessed via JMX, see CASSANDRA-6541
--XX:+CMSClassUnloadingEnabled
-
-### G1 Settings (experimental, comment previous section and uncomment section below to enable)
-
-## Use the Hotspot garbage-first collector.
-#-XX:+UseG1GC
-#
-## Have the JVM do less remembered set work during STW, instead
-## preferring concurrent GC. Reduces p99.9 latency.
-#-XX:G1RSetUpdatingPauseTimePercent=5
-#
-## Main G1GC tunable: lowering the pause target will lower throughput and vise versa.
-## 200ms is the JVM default and lowest viable setting
-## 1000ms increases throughput. Keep it smaller than the timeouts in cassandra.yaml.
-#-XX:MaxGCPauseMillis=500
-
-## Optional G1 Settings
-
-# Save CPU time on large (>= 16GB) heaps by delaying region scanning
-# until the heap is 70% full. The default in Hotspot 8u40 is 40%.
-#-XX:InitiatingHeapOccupancyPercent=70
-
-# For systems with > 8 cores, the default ParallelGCThreads is 5/8 the number of logical cores.
-# Otherwise equal to the number of cores when 8 or less.
-# Machines with > 10 cores should try setting these to <= full cores.
-#-XX:ParallelGCThreads=16
-# By default, ConcGCThreads is 1/4 of ParallelGCThreads.
-# Setting both to the same value can reduce STW durations.
-#-XX:ConcGCThreads=16
-
-### GC logging options -- uncomment to enable
-
--XX:+PrintGCDetails
--XX:+PrintGCDateStamps
--XX:+PrintHeapAtGC
--XX:+PrintTenuringDistribution
--XX:+PrintGCApplicationStoppedTime
--XX:+PrintPromotionFailure
-#-XX:PrintFLSStatistics=1
-#-Xloggc:/var/log/cassandra/gc.log
--XX:+UseGCLogFileRotation
--XX:NumberOfGCLogFiles=10
--XX:GCLogFileSize=10M

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6ba2fb93/conf/jvm11-clients.options
----------------------------------------------------------------------
diff --git a/conf/jvm11-clients.options b/conf/jvm11-clients.options
new file mode 100644
index 0000000..54465db
--- /dev/null
+++ b/conf/jvm11-clients.options
@@ -0,0 +1,21 @@
+###########################################################################
+#                         jvm11-clients.options                           #
+#                                                                         #
+# See jvm-clients.options. This file is specific for Java 11 and newer.   #
+###########################################################################
+
+###################
+#  JPMS SETTINGS  #
+###################
+
+-Djdk.attach.allowAttachSelf=true
+--add-exports java.base/jdk.internal.misc=ALL-UNNAMED
+--add-opens java.base/jdk.internal.module=ALL-UNNAMED
+--add-exports java.base/jdk.internal.ref=ALL-UNNAMED
+--add-exports java.base/sun.nio.ch=ALL-UNNAMED
+--add-exports java.management.rmi/com.sun.jmx.remote.internal.rmi=ALL-UNNAMED
+--add-exports java.rmi/sun.rmi.registry=ALL-UNNAMED
+--add-exports java.rmi/sun.rmi.server=ALL-UNNAMED
+--add-opens jdk.management/com.sun.management.internal=ALL-UNNAMED
+
+# The newline in the end of file is intentional

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6ba2fb93/conf/jvm11-server.options
----------------------------------------------------------------------
diff --git a/conf/jvm11-server.options b/conf/jvm11-server.options
new file mode 100644
index 0000000..08a7f2e
--- /dev/null
+++ b/conf/jvm11-server.options
@@ -0,0 +1,89 @@
+###########################################################################
+#                         jvm11-server.options                            #
+#                                                                         #
+# See jvm-server.options. This file is specific for Java 11 and newer.    #
+###########################################################################
+
+#################
+#  GC SETTINGS  #
+#################
+
+
+
+### CMS Settings
+#-XX:+UseParNewGC
+#-XX:+UseConcMarkSweepGC
+#-XX:+CMSParallelRemarkEnabled
+#-XX:SurvivorRatio=8
+#-XX:MaxTenuringThreshold=1
+#-XX:CMSInitiatingOccupancyFraction=75
+#-XX:+UseCMSInitiatingOccupancyOnly
+#-XX:CMSWaitDuration=10000
+#-XX:+CMSParallelInitialMarkEnabled
+#-XX:+CMSEdenChunksRecordAlways
+## some JVMs will fill up their heap when accessed via JMX, see CASSANDRA-6541
+#-XX:+CMSClassUnloadingEnabled
+
+
+
+### G1 Settings
+## Use the Hotspot garbage-first collector.
+-XX:+UseG1GC
+-XX:+ParallelRefProcEnabled
+
+#
+## Have the JVM do less remembered set work during STW, instead
+## preferring concurrent GC. Reduces p99.9 latency.
+-XX:G1RSetUpdatingPauseTimePercent=5
+#
+## Main G1GC tunable: lowering the pause target will lower throughput and vise versa.
+## 200ms is the JVM default and lowest viable setting
+## 1000ms increases throughput. Keep it smaller than the timeouts in cassandra.yaml.
+-XX:MaxGCPauseMillis=500
+
+## Optional G1 Settings
+# Save CPU time on large (>= 16GB) heaps by delaying region scanning
+# until the heap is 70% full. The default in Hotspot 8u40 is 40%.
+#-XX:InitiatingHeapOccupancyPercent=70
+
+# For systems with > 8 cores, the default ParallelGCThreads is 5/8 the number of logical cores.
+# Otherwise equal to the number of cores when 8 or less.
+# Machines with > 10 cores should try setting these to <= full cores.
+#-XX:ParallelGCThreads=16
+# By default, ConcGCThreads is 1/4 of ParallelGCThreads.
+# Setting both to the same value can reduce STW durations.
+#-XX:ConcGCThreads=16
+
+
+### JPMS
+
+-Djdk.attach.allowAttachSelf=true
+--add-exports java.base/jdk.internal.misc=ALL-UNNAMED
+--add-opens java.base/jdk.internal.module=ALL-UNNAMED
+--add-exports java.base/jdk.internal.ref=ALL-UNNAMED
+--add-exports java.base/sun.nio.ch=ALL-UNNAMED
+--add-exports java.management.rmi/com.sun.jmx.remote.internal.rmi=ALL-UNNAMED
+--add-exports java.rmi/sun.rmi.registry=ALL-UNNAMED
+--add-exports java.rmi/sun.rmi.server=ALL-UNNAMED
+--add-opens jdk.management/com.sun.management.internal=ALL-UNNAMED
+
+
+### GC logging options -- uncomment to enable
+
+# Java 11 (and newer) GC logging options:
+# See description of https://bugs.openjdk.java.net/browse/JDK-8046148 for details about the syntax
+# The following is the equivalent to -XX:+PrintGCDetails -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=10M
+#-Xlog:gc=info,heap*=trace,age*=debug,safepoint=info,promotion*=trace:file=/var/log/cassandra/gc.log:time,uptime,pid,tid,level:filecount=10,filesize=10485760
+
+# Notes for Java 8 migration:
+#
+# -XX:+PrintGCDetails                   maps to -Xlog:gc*:... - i.e. add a '*' after "gc"
+# -XX:+PrintGCDateStamps                maps to decorator 'time'
+#
+# -XX:+PrintHeapAtGC                    maps to 'heap' with level 'trace'
+# -XX:+PrintTenuringDistribution        maps to 'age' with level 'debug'
+# -XX:+PrintGCApplicationStoppedTime    maps to 'safepoint' with level 'info'
+# -XX:+PrintPromotionFailure            maps to 'promotion' with level 'trace'
+# -XX:PrintFLSStatistics=1              maps to 'freelist' with level 'trace'
+
+# The newline in the end of file is intentional

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6ba2fb93/conf/jvm8-clients.options
----------------------------------------------------------------------
diff --git a/conf/jvm8-clients.options b/conf/jvm8-clients.options
new file mode 100644
index 0000000..7d1b2ef
--- /dev/null
+++ b/conf/jvm8-clients.options
@@ -0,0 +1,9 @@
+###########################################################################
+#                         jvm8-clients.options                            #
+#                                                                         #
+# See jvm-clients.options. This file is specific for Java 8 and newer.    #
+###########################################################################
+
+# intentionally left empty
+
+# The newline in the end of file is intentional


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