gnodet commented on code in PR #26000:
URL: https://github.com/apache/camel/pull/26000#discussion_r3903105818
##########
components/camel-ai/camel-kserve/src/main/java/org/apache/camel/component/kserve/KServeEndpoint.java:
##########
@@ -73,8 +75,11 @@ protected void doInit() throws Exception {
public void doStop() throws Exception {
super.doStop();
- // Close the channel
- channel.shutdown();
+ // Close the channel if it was created (doInit may have failed before
assigning it)
+ if (channel != null) {
+ channel.shutdown();
+ channel.awaitTermination(5, TimeUnit.SECONDS);
+ }
Review Comment:
💡 Minor improvement (not blocking): the `awaitTermination` return value is
ignored. If it returns `false` (channel didn't fully terminate within 5
seconds), calling `shutdownNow()` would force-terminate lingering RPCs. This
matches the pattern in `GrpcProducer.doStop()`:
```suggestion
// Close the channel if it was created (doInit may have failed
before assigning it)
if (channel != null) {
channel.shutdown();
if (!channel.awaitTermination(5, TimeUnit.SECONDS)) {
channel.shutdownNow();
}
}
```
##########
components/camel-ai/camel-tensorflow-serving/src/main/java/org/apache/camel/component/tensorflow/serving/TensorFlowServingEndpoint.java:
##########
@@ -71,8 +73,11 @@ protected void doInit() throws Exception {
public void doStop() throws Exception {
super.doStop();
- // Close the channel
- channel.shutdown();
+ // Close the channel if it was created (doInit may have failed before
assigning it)
+ if (channel != null) {
+ channel.shutdown();
+ channel.awaitTermination(5, TimeUnit.SECONDS);
+ }
Review Comment:
💡 Same suggestion as above — add `shutdownNow()` fallback:
```suggestion
// Close the channel if it was created (doInit may have failed
before assigning it)
if (channel != null) {
channel.shutdown();
if (!channel.awaitTermination(5, TimeUnit.SECONDS)) {
channel.shutdownNow();
}
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]