Introduce multi-release JAR#28051
Merged
jasontedor merged 20 commits intoelastic:masterfrom Jan 16, 2018
Merged
Conversation
This commit introduces the ability for the core Elasticsearch JAR to be a multi-release JAR containing code that is compiled for JDK 8 and code that is compiled for JDK 9. At runtime, a JDK 8 JVM will ignore the JDK 9 compiled classfiles, and a JDK 9 JVM will use the JDK 9 compiled classfiles instead of the JDK 8 compiled classfiles. With this work, we utilize the new JDK 9 API for obtaining the PID of the running JVM, instead of relying on a hack. For now, we want to keep IDEs on JDK 8 so when the build is in an IDE we ignore the JDK 9 source set (as otherwise the IDE would give compilation errors). However, with this change, running Gradle from the command-line now requires JAVA_HOME and JAVA_9_HOME to be set. This will require follow-up work in our CI infrastructure and our release builds to accommodate this change.
nik9000
approved these changes
Jan 2, 2018
|
|
||
| import java.lang.management.ManagementFactory; | ||
|
|
||
| class JvmPid { |
Member
There was a problem hiding this comment.
Many of our test fixtures could use this too.
| class JvmPid { | ||
|
|
||
| static long getPid() { | ||
| return ProcessHandle.current().pid(); |
| sourceSets { | ||
| java9 { | ||
| java { | ||
| srcDirs = ['src/main/java9'] |
* master: Enable convert processor to support Long and Double. (elastic#27957) Enable Wildfly tests on JDK 9 and JDK 10 [Test] Fix allowed delta for calculated scores in DiscountedCumulativeGainTests
This commit modifies the build to require JDK 9 for compilation. Henceforth, we will compile with a JDK 9 compiler targeting JDK 8 as the class file format. Optionally, JAVA_8_HOME can be set as the runtime JDK used for running tests. To enable this change, we separate the meaning of the compiler Java home versus the runtime Java home. If the runtime Java home is not set (via JAVA_8_HOME) then we fallback to using JAVA_HOME as the runtime Java home. This enables: - developers only have to set one Java home (JAVA_HOME) - developers can set an optional Java home (JAVA_8_HOME) to test on the minimum supported runtime - we can test compiling with JDK 9 running on JDK 8 and compiling with JDK 9 running on JDK 9 in CI
* master: Set the elasticsearch-nio codebase for tests (elastic#28067) Bump compat version for local depdendent test to 6.2.0 Pass `java.locale.providers=COMPAT` to Java 9 onwards (elastic#28080) Allow shrinking of indices from a previous major (elastic#28076) Remove deprecated exceptions (elastic#28059) Add Writeable.Reader support to TransportResponseHandler (elastic#28010) Plugins: Add plugin extension capabilities (elastic#27881)
* master: test: replaced try-catch statements with expectThrows(...) Add getWarmer and getTranslog method to NodeIndicesStats (elastic#28092) fix doc mistake Added ASN support for Ingest GeoIP plugin. Fix global aggregation that requires breadth first and scores (elastic#27942) Introduce Gradle wrapper Ignore GIT_COMMIT when calculating commit hash Re-enable bwc tests after elastic#27881 was backported
* master: (25 commits) Remove Gradle cheatsheet Fix reproduction info to point to Gradle wrapper Update platforms tests to use Gradle wrapper Update testing docs to reflect Gradle wrapper Painless: Modify Loader to Load Classes Directly from Definition (elastic#28088) Update contributing docs to use the Gradle wrapper Create nio-transport plugin for NioTransport (elastic#27949) test: replaced try-catch statements with expectThrows(...) Add getWarmer and getTranslog method to NodeIndicesStats (elastic#28092) fix doc mistake Added ASN support for Ingest GeoIP plugin. Fix global aggregation that requires breadth first and scores (elastic#27942) Introduce Gradle wrapper Ignore GIT_COMMIT when calculating commit hash Re-enable bwc tests after elastic#27881 was backported Set the elasticsearch-nio codebase for tests (elastic#28067) Bump compat version for local depdendent test to 6.2.0 Pass `java.locale.providers=COMPAT` to Java 9 onwards (elastic#28080) Allow shrinking of indices from a previous major (elastic#28076) Remove deprecated exceptions (elastic#28059) ...
* compile-with-jdk-9: Runtime Java home Fix reindex from remote tests Update docs Require JDK 9 for compilation
* master: Remove Gradle cheatsheet Fix reproduction info to point to Gradle wrapper Update platforms tests to use Gradle wrapper Update testing docs to reflect Gradle wrapper Painless: Modify Loader to Load Classes Directly from Definition (elastic#28088) Update contributing docs to use the Gradle wrapper Create nio-transport plugin for NioTransport (elastic#27949)
* master: Use Gradle wrapper when building BWC Painless: Add a simple cache for whitelist methods and fields. (elastic#28142) Fix upgrading indices which use a custom similarity plugin. (elastic#26985) Fix Licenses values for CDDL and Custom URL (elastic#27999) Cleanup TcpChannelFactory and remove classes (elastic#28102) Fix expected plugins test for transport-nio [Docs] Fix Date Math example descriptions (elastic#28125) Fail rollover if duplicated alias found in template (elastic#28110) Avoid concurrent snapshot finalizations when deleting an INIT snapshot (elastic#28078) Deprecate `isShardsAcked()` in favour of `isShardsAcknowledged()` (elastic#27819) [TEST] Wait for replicas to be allocated before shrinking Use the underlying connection version for CCS connections (elastic#28093) test: do not use asn fields Test: Add assumeFalse for test that cannot pass on windows Clarify reproduce info on Windows Remove out-of-date projectile file
* master: Fix Gradle wrapper usage on Windows when building BWC (elastic#28146) [Docs] Fix some typos in comments (elastic#28098)
* master: Set watermarks in single-node test cases Add the ability to bundle multiple plugins into a meta plugin (elastic#28022) Declare empty package dirs as output dirs Consistent updates of IndexShardSnapshotStatus (elastic#28130)
* master: (30 commits) Fix lock accounting in releasable lock Add ability to associate an ID with tasks (elastic#27764) [DOCS] Removed differencies between text and code (elastic#27993) text fixes (elastic#28136) Update getting-started.asciidoc (elastic#28145) [Docs] Spelling fix in painless-getting-started.asciidoc (elastic#28187) Fixed the cat.health REST test to accept 4ms, not just 4.0ms (elastic#28186) Do not keep 5.x commits once having 6.x commits (elastic#28188) Rename core module to server (elastic#28180) upgraded jna from 4.4.0-1 to 4.5.1 (elastic#28183) [TEST] Do not call RandomizedTest.scaledRandomIntBetween from multiple threads Primary send safe commit in file-based recovery (elastic#28038) [Docs] Correct response json in rank-eval.asciidoc Add scroll parameter to _reindex API (elastic#28041) Include all sentences smaller than fragment_size in the unified highlighter (elastic#28132) Modifies the JavaAPI docs related to AggregationBuilder [Docs] Improvements in script-fields.asciidoc (elastic#28174) [Docs] Remove Kerberos/SPNEGO Shield plugin (elastic#28019) Ignore null value for range field (elastic#27845) (elastic#28116) Fix environment variable substitutions in list setting (elastic#28106) ...
* master: TEST: init unassigned gcp in testAcquireIndexCommit Replica start peer recovery with safe commit (elastic#28181) Truncate tlog cli should assign global checkpoint (elastic#28192)
* compile-with-jdk-9: (56 commits) TEST: init unassigned gcp in testAcquireIndexCommit Replica start peer recovery with safe commit (elastic#28181) Truncate tlog cli should assign global checkpoint (elastic#28192) Fix lock accounting in releasable lock Add ability to associate an ID with tasks (elastic#27764) [DOCS] Removed differencies between text and code (elastic#27993) text fixes (elastic#28136) Update getting-started.asciidoc (elastic#28145) [Docs] Spelling fix in painless-getting-started.asciidoc (elastic#28187) Fixed the cat.health REST test to accept 4ms, not just 4.0ms (elastic#28186) Do not keep 5.x commits once having 6.x commits (elastic#28188) Rename core module to server (elastic#28180) upgraded jna from 4.4.0-1 to 4.5.1 (elastic#28183) [TEST] Do not call RandomizedTest.scaledRandomIntBetween from multiple threads Primary send safe commit in file-based recovery (elastic#28038) [Docs] Correct response json in rank-eval.asciidoc Add scroll parameter to _reindex API (elastic#28041) Include all sentences smaller than fragment_size in the unified highlighter (elastic#28132) Modifies the JavaAPI docs related to AggregationBuilder [Docs] Improvements in script-fields.asciidoc (elastic#28174) ...
* master: (35 commits) Move the multi-get response tests to server Require JDK 9 for compilation (elastic#28071) Revert "[Docs] Fix Java Api index administration usage (elastic#28133)" Revert "[Docs] Fix base directory to include for put_mapping.asciidoc" Added multi get api to the high level rest client. [Docs] Clarify numeric datatype ranges (elastic#28240) [Docs] Fix base directory to include for put_mapping.asciidoc Open engine should keep only starting commit (elastic#28228) [Docs] Fix Java Api index administration usage (elastic#28133) Fix eclipse build. (elastic#28236) Never return null from Strings.tokenizeToStringArray (elastic#28224) Fallback to TransportMasterNodeAction for cluster health retries (elastic#28195) [Docs] Changes to ingest.asciidoc (elastic#28212) TEST: Update logging for testAckedIndexing [GEO] Add WKT Support to GeoBoundingBoxQueryBuilder Painless: Add whitelist extensions (elastic#28161) Fix daitch_mokotoff phonetic filter to use the dedicated Lucene filter (elastic#28225) Avoid doing redundant work when checking for self references. (elastic#26927) Fix casts in HotThreads. (elastic#27578) Ignore the `-snapshot` suffix when comparing the Lucene version in the build and the docs. (elastic#27927) ...
jasontedor
added a commit
that referenced
this pull request
Jan 16, 2018
This commit introduces the ability for the core Elasticsearch JAR to be a multi-release JAR containing code that is compiled for JDK 8 and code that is compiled for JDK 9. At runtime, a JDK 8 JVM will ignore the JDK 9 compiled classfiles, and a JDK 9 JVM will use the JDK 9 compiled classfiles instead of the JDK 8 compiled classfiles. With this work, we utilize the new JDK 9 API for obtaining the PID of the running JVM, instead of relying on a hack. For now, we want to keep IDEs on JDK 8 so when the build is in an IDE we ignore the JDK 9 source set (as otherwise the IDE would give compilation errors). However, with this change, running Gradle from the command-line now requires JAVA_HOME and JAVA_9_HOME to be set. This will require follow-up work in our CI infrastructure and our release builds to accommodate this change. Relates #28051
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit introduces the ability for the core Elasticsearch JAR to be a multi-release JAR containing code that is compiled for JDK 8 and code that is compiled for JDK 9. At runtime, a JDK 8 JVM will ignore the JDK 9 compiled classfiles, and a JDK 9 JVM will use the JDK 9 compiled classfiles instead of the JDK 8 compiled classfiles. With this work, we utilize the new JDK 9 API for obtaining the PID of the running JVM, instead of relying on a hack.
For now, we want to keep IDEs on JDK 8 so when the build is in an IDE we ignore the JDK 9 source set (as otherwise the IDE would give compilation errors). However, with this change, running Gradle from the command-line now requires JAVA_HOME and JAVA_9_HOME to be set. This will require follow-up work in our CI infrastructure and our release builds to accommodate this change.