Skip to content

Commit a25bf92

Browse files
committed
fix: propagate exceptions and stop on start exception
1 parent 031c22e commit a25bf92

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/Operator.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ public void start() {
102102
controllers.start();
103103
} catch (Exception e) {
104104
log.error("Error starting operator", e);
105-
System.exit(1);
105+
stop();
106+
throw e;
106107
}
107108
}
108109

@@ -209,10 +210,6 @@ public synchronized void start() {
209210
}
210211

211212
public synchronized void stop() {
212-
if (!started) {
213-
return;
214-
}
215-
216213
this.controllers.values().parallelStream().forEach(closeable -> {
217214
log.debug("closing {}", closeable);
218215
closeable.stop();

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/Controller.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,7 @@ public void start() throws OperatorException {
332332

333333
log.info("'{}' controller started, pending event sources initialization", controllerName);
334334
} catch (MissingCRDException e) {
335+
stop();
335336
throwMissingCRDException(crdName, specVersion, controllerName);
336337
}
337338
}

0 commit comments

Comments
 (0)