essobedo commented on code in PR #9023: URL: https://github.com/apache/camel/pull/9023#discussion_r1064817082
########## core/camel-management/src/main/java/org/apache/camel/management/mbean/ManagedCamelContext.java: ########## @@ -413,11 +414,12 @@ public boolean canSendToEndpoint(String endpointUri) { @Override public void sendBody(String endpointUri, Object body) throws Exception { - ProducerTemplate template = context.createProducerTemplate(); - try { - template.sendBody(endpointUri, body); - } finally { - template.stop(); + try (ProducerTemplate template = context.createProducerTemplate()) { + try { + template.sendBody(endpointUri, body); + } finally { + template.stop(); + } Review Comment: Do we really need to call `stop` explicitly knowing that `stop` is called on `close`? -- 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-unsubscr...@camel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org