gnodet commented on code in PR #23127:
URL: https://github.com/apache/camel/pull/23127#discussion_r3224052344


##########
core/camel-main/src/main/java/org/apache/camel/main/DevModeContentCacheStrategy.java:
##########
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.main;
+
+import org.apache.camel.Component;
+import org.apache.camel.spi.ContentCacheAware;
+import org.apache.camel.support.LifecycleStrategySupport;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Lifecycle strategy that disables content caching on resource-based 
components when routes-reload is enabled. Lets
+ * users edit a resource file (e.g. an XSLT stylesheet) and see the change 
applied live, without having to set
+ * {@code contentCache=false} on every endpoint.
+ *
+ * Only flips components that have not been explicitly configured by the user 
(i.e.
+ * {@link ContentCacheAware#getContentCache()} returns {@code null}); explicit 
user settings are preserved.
+ */
+public class DevModeContentCacheStrategy extends LifecycleStrategySupport {

Review Comment:
   Nit: this class is only instantiated from `DefaultConfigurationConfigurer` 
in the same package. Consider reducing visibility to package-private:
   
   ```suggestion
   class DevModeContentCacheStrategy extends LifecycleStrategySupport {
   ```



##########
components/camel-xslt/src/main/java/org/apache/camel/component/xslt/XsltComponent.java:
##########
@@ -102,7 +108,8 @@ public boolean isContentCache() {
      * stylesheet file on each message processing. This is good for 
development. A cached stylesheet can be forced to
      * reload at runtime via JMX using the clearCachedStylesheet operation.
      */
-    public void setContentCache(boolean contentCache) {
+    @Override
+    public void setContentCache(Boolean contentCache) {
         this.contentCache = contentCache;
     }

Review Comment:
   The `setContentCache(boolean)` → `setContentCache(Boolean)` signature change 
breaks binary backward compatibility (JVM method descriptor changes from `(Z)V` 
to `(Ljava/lang/Boolean;)V`). Existing compiled code calling 
`component.setContentCache(true)` would get a `NoSuchMethodError` at runtime.
   
   Consider keeping the old `boolean` overload as a deprecated bridge:
   
   ```suggestion
       @Override
       public void setContentCache(Boolean contentCache) {
           this.contentCache = contentCache;
       }
   
       /**
        * @deprecated use {@link #setContentCache(Boolean)}
        */
       @Deprecated
       public void setContentCache(boolean contentCache) {
           this.contentCache = contentCache;
       }
   ```



-- 
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]

Reply via email to