#
# 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.
#

# JDK 9+ module system compatibility. Two independent consumers need these flags:
#   1. Hazelcast, which the Zeta engine is built on. Its own serialization and networking
#      internals reflectively touch these JDK APIs; nothing in this codebase calls them
#      directly, so there is no first-party call site in our source to point to for these.
#   2. This project's own reflective code: the Kerberos configuration reload helpers
#      (KuduUtil, PaimonSecurityContext) and the connector classloader injection helpers
#      (AbstractPluginDiscovery, ConfigValidationUtils, the Flink starter plugin loaders),
#      which are named per-flag below.
# Source of truth: the launcher scripts (seatunnel.sh, seatunnel-cluster.sh) append the mandatory
# flags below themselves, skipping any already present. The entries in this file are a
# convenience and documentation; do not remove the launcher injection assuming this file is
# sufficient, because a preserved config directory would then silently lose the flags.
# Without these flags the Kerberos reload helpers log an ERROR naming the missing flag; other
# consumers may not report it until the affected path is actually exercised.
# Evidence status: only java.net has a captured failing stack trace (ReflectionUtilsTest).
# The other entries are not proven necessary by a captured failure on this project's CI and
# are candidates to trim later.
# Required by Hazelcast internals (see note 1 above).
# Evidence: no captured failure on this project's CI; candidate to trim.
--add-opens=java.base/java.lang=ALL-UNNAMED
# Required by URLClassLoader#addURL reflection: AbstractPluginDiscovery,
# ConfigValidationUtils, and the Flink starter plugin loaders inject connector jars this way.
--add-opens=java.base/java.net=ALL-UNNAMED
# Required by Hazelcast internals (see note 1 above).
# Evidence: also required by Apache Arrow (connector-lance unit tests fail on JDK 17 without it).
--add-opens=java.base/java.nio=ALL-UNNAMED
# Required by Hazelcast internals (see note 1 above).
# Evidence: no captured failure on this project's CI; candidate to trim.
--add-opens=java.base/java.util=ALL-UNNAMED
# Required by Hazelcast internals (see note 1 above).
# Evidence: no captured failure on this project's CI; candidate to trim.
--add-opens=java.base/sun.nio.ch=ALL-UNNAMED
# Required by the Kerberos configuration reload helpers KuduUtil and PaimonSecurityContext,
# which reflectively call sun.security.krb5.Config#refresh() to pick
# up a custom krb5.conf without a JVM restart.
# Evidence: no captured failure on this project's CI; kept for the reflective reload.
--add-exports=java.security.jgss/sun.security.krb5=ALL-UNNAMED

# JVM Heap
# -Xms2g
# -Xmx2g

# JVM Dump
-XX:+HeapDumpOnOutOfMemoryError
-XX:HeapDumpPath=/tmp/seatunnel/dump/zeta-server

# Metaspace
-XX:MaxMetaspaceSize=2g

# G1GC
-XX:+UseG1GC

# GC Logging
# Uncomment the following options to enable GC logging for troubleshooting and performance analysis.
# The GC log directory will be automatically created on startup if it doesn't exist.
# -XX:+PrintGCDetails
# -XX:+PrintGCDateStamps
# -XX:+PrintGCTimeStamps
# -Xloggc:/tmp/seatunnel/gc/gc.log
# -XX:+UseGCLogFileRotation
# -XX:NumberOfGCLogFiles=10
# -XX:GCLogFileSize=200M
# -XX:+PrintGCApplicationStoppedTime
