You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "orpiske (via GitHub)" <gi...@apache.org> on 2025/10/02 14:00:11 UTC
[PR] CAMEL-22485: add a way to clean up resources [camel]
orpiske opened a new pull request, #19402:
URL: https://github.com/apache/camel/pull/19402
(no comment)
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-22485: add a way to clean up resources [camel]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #19402:
URL: https://github.com/apache/camel/pull/19402#issuecomment-3361356671
:star2: Thank you for your contribution to the Apache Camel project! :star2:
:robot: CI automation will test this PR automatically.
:camel: Apache Camel Committers, please review the following items:
* First-time contributors **require MANUAL approval** for the GitHub Actions to run
* You can use the command `/component-test (camel-)component-name1 (camel-)component-name2..` to request a test from the test bot.
* You can label PRs using `build-all`, `build-dependents`, `skip-tests` and `test-dependents` to fine-tune the checks executed by this PR.
* Build and test logs are available in the Summary page. **Only** [Apache Camel committers](https://camel.apache.org/community/team/#committers) have access to the summary.
* :warning: Be careful when sharing logs. Review their contents before sharing them publicly.
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-22485: add a way to clean up resources [camel]
Posted by "orpiske (via GitHub)" <gi...@apache.org>.
orpiske commented on code in PR #19402:
URL: https://github.com/apache/camel/pull/19402#discussion_r2399079000
##########
core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultContextServiceLoaderPlugin.java:
##########
@@ -58,13 +59,22 @@ public class DefaultContextServiceLoaderPlugin extends ServiceSupport implements
*/
@Override
protected void doStart() throws Exception {
- ServiceLoader<ContextServicePlugin> contextServicePlugins = ServiceLoader.load(ContextServicePlugin.class,
+ contextServicePlugins = ServiceLoader.load(ContextServicePlugin.class,
camelContext.getApplicationContextClassLoader());
for (ContextServicePlugin plugin : contextServicePlugins) {
plugin.load(camelContext);
}
}
+ @Override
+ protected void doStop() throws Exception {
+ if (contextServicePlugins != null) {
+ for (ContextServicePlugin plugin : contextServicePlugins) {
Review Comment:
Good idea. Let me do that!
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-22485: add a way to clean up resources [camel]
Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus commented on code in PR #19402:
URL: https://github.com/apache/camel/pull/19402#discussion_r2398966397
##########
core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultContextServiceLoaderPlugin.java:
##########
@@ -58,13 +59,22 @@ public class DefaultContextServiceLoaderPlugin extends ServiceSupport implements
*/
@Override
protected void doStart() throws Exception {
- ServiceLoader<ContextServicePlugin> contextServicePlugins = ServiceLoader.load(ContextServicePlugin.class,
+ contextServicePlugins = ServiceLoader.load(ContextServicePlugin.class,
camelContext.getApplicationContextClassLoader());
for (ContextServicePlugin plugin : contextServicePlugins) {
plugin.load(camelContext);
}
}
+ @Override
+ protected void doStop() throws Exception {
+ if (contextServicePlugins != null) {
+ for (ContextServicePlugin plugin : contextServicePlugins) {
Review Comment:
You may want to do a try .. catch and LOG warn about ignoring this exception so all the plugins can do their stop logic as that is more important than if one fails then the others are not unloaded.
##########
core/camel-api/src/main/java/org/apache/camel/spi/ContextServicePlugin.java:
##########
@@ -66,4 +66,11 @@ public interface ContextServicePlugin {
* @param camelContext the CamelContext being initialized, never {@code null}
*/
void load(CamelContext camelContext);
+
+ /**
+ * Called during CamelContext stop. Use it to free allocated resources.
+ */
+ default void unload() {
Review Comment:
Maybe add CamelContext so its same as load
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-22485: add a way to clean up resources [camel]
Posted by "orpiske (via GitHub)" <gi...@apache.org>.
orpiske merged PR #19402:
URL: https://github.com/apache/camel/pull/19402
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-22485: add a way to clean up resources [camel]
Posted by "orpiske (via GitHub)" <gi...@apache.org>.
orpiske commented on PR #19402:
URL: https://github.com/apache/camel/pull/19402#issuecomment-3362075874
Failing due to some formatting issues. I will fix after the class
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-22485: add a way to clean up resources [camel]
Posted by "orpiske (via GitHub)" <gi...@apache.org>.
orpiske commented on code in PR #19402:
URL: https://github.com/apache/camel/pull/19402#discussion_r2399096460
##########
core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultContextServiceLoaderPlugin.java:
##########
@@ -58,13 +63,27 @@ public class DefaultContextServiceLoaderPlugin extends ServiceSupport implements
*/
@Override
protected void doStart() throws Exception {
- ServiceLoader<ContextServicePlugin> contextServicePlugins = ServiceLoader.load(ContextServicePlugin.class,
+ contextServicePlugins = ServiceLoader.load(ContextServicePlugin.class,
camelContext.getApplicationContextClassLoader());
for (ContextServicePlugin plugin : contextServicePlugins) {
plugin.load(camelContext);
Review Comment:
I'm thinking we should do the same logic for the unload.
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org