feat(startup_scripts): add looker21 script for JDK 21 support#32
Conversation
Add a new startup script `looker21` specifically for running Looker on JDK 21. This script: - Enforces JDK 21 version check. - Adds JVM flags required for JRuby compatibility on JDK 21: - `--add-opens=java.base/sun.nio.ch=ALL-UNNAMED` - `--add-opens=java.base/java.io=ALL-UNNAMED` - `--add-opens=java.base/java.nio=ALL-UNNAMED` - Removes obsolete Nashorn flags. This allows on-premise customers to transition to JDK 21.
There was a problem hiding this comment.
Code Review
This pull request introduces a new startup script startup_scripts/looker21 to support running Looker with OpenJDK 21. The feedback highlights several shell scripting issues to improve robustness and POSIX compliance: replacing the Bash-specific brace expansion {1..30} with a POSIX-compliant while loop, using string comparison instead of -ne to avoid syntax errors when java is missing, handling potential failures of the cd command, adding a fallback for memory calculation if /proc/meminfo is unavailable, and verifying the existence of the PID file before reading it.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
…feedback
Apply suggestions from code review to improve portability and safety of the `looker21` script:
- Use string comparison for Java version check to handle empty values.
- Make directory change (`cd`) safe and quote paths.
- Make memory calculation robust with fallback and POSIX arithmetic.
- Use POSIX-compliant loop instead of Bash brace expansion `{1..30}` in `stop()`.
- Verify PID file existence before reading it in `stop()`.
Description
Add a new startup script
looker21specifically for running Looker on JDK 21. This script:--add-opens=java.base/sun.nio.ch=ALL-UNNAMED--add-opens=java.base/java.io=ALL-UNNAMED--add-opens=java.base/java.nio=ALL-UNNAMEDThis allows on-premise customers to transition to JDK 21.
High-level Diff
The script has been copied from
looker11, here is the diff between the 2 files generated by runninggit diff --no-index startup_scripts/looker11 startup_scripts/looker21:Script Improvements
Gemini suggested a bunch of improvements, which I've incorporated. I'm presenting those diffs seprately in this section.
Robust Java Version Check
Handles cases where the version variable might be empty (e.g., if Java is not installed/configured), preventing shell syntax errors.
Safe Directory Change
Ensures the script aborts immediately if it cannot access the Looker directory, rather than executing commands in the wrong path. Quotes the path to handle spaces safely.
Robust Memory Calculation with Fallback
Modernizes the math using POSIX arithmetic (
$((...))) instead ofexpr, and adds a fallback memory allocation (2048m) if/proc/meminfois unreadable (e.g., on macOS or in some containerized environments).Portable Graceful Shutdown Loop & PID Validation
.tmp/looker.pidexists before attempting to read it and kill the process.for i in {1..30}with a POSIX-compliantwhileloop, ensuring graceful shutdown works on Debian/Ubuntu (which usedashas/bin/shby default).catbackticks to$()syntax.