davsclaus commented on code in PR #27835:
URL: https://github.com/apache/camel/pull/27835#discussion_r4275137982
##########
docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc:
##########
@@ -13,6 +13,18 @@ See the xref:camel-upgrade-recipes-tool.adoc[documentation]
page for details.
== Upgrading Camel 4.23 to 4.24
+=== camel-core - Route.clearRouteModel() is deprecated
+
+The `Route.clearRouteModel()` method is deprecated and is now a no-op. It will
be removed in a later release.
+
+This method dropped the references a runtime route held to its model (the
route definition, the error handler factory
+and the error handlers) once the route was created at startup. The
`CamelContext` already keeps the route definitions
+in its model, so clearing them on the route saved little memory at the cost of
making `Route.getRoute()` and
+`Route.getErrorHandlerFactory()` return `null` for routes created at startup
(but not for routes added after startup).
+
+Applications that called `Route.clearRouteModel()` directly can remove the
call. Implementations of the `Route` interface
+that override `clearRouteModel()` can remove the override.
Review Comment:
This is only true if `clearRouteModel()` becomes a `default` method in
`Route` (see the comment on `Route.java`). As it is now the method is abstract,
so a `Route` implementation that removes its override does not compile.
##########
core/camel-api/src/main/java/org/apache/camel/Route.java:
##########
@@ -380,16 +380,18 @@ default Resource getTemplatedRouteResource() {
/**
* Get the route type.
*
- * Important: is null after the route has been created.
- *
- * @return the route type during creation of the route, is null after the
route has been created.
+ * @return the route type, no longer null after the route has been created.
*/
Review Comment:
+1 to the gnodet-bot comment. Keep `@Nullable` (a `Route` does not have to
be created from a model, and two tests create a `DefaultRoute` with a null
route), and say what is returned:
```suggestion
/**
* Gets the route model (such as the route definition) this route was
created from.
*
* @return the route model, or null if this route was not created from a
model
*/
```
##########
core/camel-api/src/main/java/org/apache/camel/Route.java:
##########
@@ -380,16 +380,18 @@ default Resource getTemplatedRouteResource() {
/**
* Get the route type.
*
- * Important: is null after the route has been created.
- *
- * @return the route type during creation of the route, is null after the
route has been created.
+ * @return the route type, no longer null after the route has been created.
*/
@Nullable
NamedNode getRoute();
/**
* Clears the route model when its no longer needed.
+ *
+ * @deprecated since 4.24.0 - the route model is retained at runtime; this
method is a no-op and will be removed in
+ * a later release.
*/
+ @Deprecated(since = "4.24.0", forRemoval = true)
void clearRouteModel();
Review Comment:
Suggest a `default` no-op here. Then `DefaultRoute` does not need its
override (it can be removed), and a custom `Route` implementation can drop its
override as the upgrade guide says. Changing an abstract method to a default
method is source and binary compatible.
```suggestion
/**
* Clears the route model when its no longer needed.
*
* @deprecated since 4.24.0 - the route model is retained at runtime;
this method is a no-op and will be removed in
* a later release.
*/
@Deprecated(since = "4.24.0", forRemoval = true)
default void clearRouteModel() {
// noop
}
```
--
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]