You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by dp...@apache.org on 2019/02/11 16:17:23 UTC
[ignite] branch master updated: IGNITE-11155 Add JVM options
analysis to Ignition.start() or handle and comment exceptions (#6054)
This is an automated email from the ASF dual-hosted git repository.
dpavlov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git
The following commit(s) were added to refs/heads/master by this push:
new d0c7925 IGNITE-11155 Add JVM options analysis to Ignition.start() or handle and comment exceptions (#6054)
d0c7925 is described below
commit d0c7925ac09b04bada1f8656b6397b4d97d41e4b
Author: Dmitriy Pavlov <dp...@apache.org>
AuthorDate: Mon Feb 11 19:17:17 2019 +0300
IGNITE-11155 Add JVM options analysis to Ignition.start() or handle and comment exceptions (#6054)
---
.../ignite/internal/util/FeatureChecker.java | 38 ++++++++++++++++++++++
.../apache/ignite/internal/util/GridUnsafe.java | 9 +++--
2 files changed, 44 insertions(+), 3 deletions(-)
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/FeatureChecker.java b/modules/core/src/main/java/org/apache/ignite/internal/util/FeatureChecker.java
new file mode 100644
index 0000000..5aba646
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/FeatureChecker.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ignite.internal.util;
+
+/**
+ * Class extracted for fields from GridUnsafe to be absolutely independent with current and future static block
+ * initialization effects.
+ */
+public class FeatureChecker {
+ /** Required Options to Run un Java 9, 10, 11. */
+ public static final String JAVA_9_10_11_OPTIONS = "--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED\n" +
+ "--add-exports=java.base/sun.nio.ch=ALL-UNNAMED\n" +
+ "--add-exports=java.management/com.sun.jmx.mbeanserver=ALL-UNNAMED\n" +
+ "--add-exports=jdk.internal.jvmstat/sun.jvmstat.monitor=ALL-UNNAMED\n" +
+ "--add-exports=java.base/sun.reflect.generics.reflectiveObjects=ALL-UNNAMED\n" +
+ "--illegal-access=permit";
+
+ /** Java version specific warning to be added in case access failed */
+ public static final String JAVA_VER_SPECIFIC_WARN =
+ "\nPlease add the following parameters to JVM startup settings and restart the application: {parameters: " +
+ JAVA_9_10_11_OPTIONS +
+ "\n}" +
+ "\nSee https://apacheignite.readme.io/docs/getting-started#section-running-ignite-with-java-9-10-11 for more information.";
+}
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/GridUnsafe.java b/modules/core/src/main/java/org/apache/ignite/internal/util/GridUnsafe.java
index 6b8e2b3..f485218 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/GridUnsafe.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/GridUnsafe.java
@@ -137,7 +137,8 @@ public abstract class GridUnsafe {
return buf;
}
catch (ReflectiveOperationException e) {
- throw new RuntimeException("JavaNioAccess#newDirectByteBuffer() method is unavailable.", e);
+ throw new RuntimeException("JavaNioAccess#newDirectByteBuffer() method is unavailable."
+ + FeatureChecker.JAVA_VER_SPECIFIC_WARN, e);
}
}
@@ -1451,7 +1452,8 @@ public abstract class GridUnsafe {
return mth.invoke(null);
}
catch (ReflectiveOperationException e) {
- throw new RuntimeException(pkgName + ".misc.JavaNioAccess class is unavailable.", e);
+ throw new RuntimeException(pkgName + ".misc.JavaNioAccess class is unavailable."
+ + FeatureChecker.JAVA_VER_SPECIFIC_WARN, e);
}
}
@@ -1474,7 +1476,8 @@ public abstract class GridUnsafe {
return mtd;
}
catch (ReflectiveOperationException e) {
- throw new RuntimeException(miscPackage() + ".JavaNioAccess#newDirectByteBuffer() method is unavailable.", e);
+ throw new RuntimeException(miscPackage() + ".JavaNioAccess#newDirectByteBuffer() method is unavailable."
+ + FeatureChecker.JAVA_VER_SPECIFIC_WARN, e);
}
}