File tree Expand file tree Collapse file tree
operator-framework-core/src/main/java/io/javaoperatorsdk/operator Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -137,11 +137,22 @@ protected ConfigurationService initConfigurationService(
137137 * <p>Note that you might want to tune "terminationGracePeriodSeconds" for the Pod running the
138138 * controller.
139139 *
140- * @param gracefulShutdownTimeout timeout to wait for executor threads to complete actual
141- * reconciliations
140+ * @param gracefulShutdownTimeout ignored, configure {@link
141+ * ConfigurationService#reconciliationTerminationTimeout()} instead
142+ * @deprecated Use {@link #installShutdownHook()} instead
142143 */
143144 @ SuppressWarnings ("unused" )
145+ @ Deprecated (forRemoval = true )
144146 public void installShutdownHook (Duration gracefulShutdownTimeout ) {
147+ installShutdownHook ();
148+ }
149+
150+ /**
151+ * Adds a shutdown hook that automatically calls {@link #stop()} when the app shuts down. Note
152+ * that graceful shutdown is usually not needed, but some {@link Reconciler} implementations might
153+ * require it.
154+ */
155+ public void installShutdownHook () {
145156 if (!leaderElectionManager .isLeaderElectionEnabled ()) {
146157 Runtime .getRuntime ().addShutdownHook (new Thread (this ::stop ));
147158 } else {
@@ -188,6 +199,10 @@ public synchronized void start() {
188199 }
189200 }
190201
202+ /**
203+ * Gracefully shuts down the operator, using the timeout defined by {@link
204+ * ConfigurationService#reconciliationTerminationTimeout()} to wait for reconciliations to finish.
205+ */
191206 @ Override
192207 public void stop () throws OperatorException {
193208 Duration reconciliationTerminationTimeout =
You can’t perform that action at this time.
0 commit comments