This is an automated email from the ASF dual-hosted git repository. rmaucher pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit ce47349c292b3cd069c7858ee16b4655f97a35ac Author: opencode <[email protected]> AuthorDate: Sun Oct 11 12:00:55 2026 +0200 Warn when static membership properties are replaced while running The membership service exposes its properties as a read write JMX attribute, as the required setProperties method of the membership service interface makes the attribute writable. Replacing the properties while the service ran silently desynchronized the reported configuration from the live one, for the attribute getters read the replaced properties while the membership provider keeps the values it read when it was built at start, and re-reads none of them until it is rebuilt. The contract of setProperties is now documented, and replacing the properties while a provider exists logs a warning naming the divergence, so an administrative change that does not take effect until a full stop and start can no longer pass unnoticed. Add no test, for the only runtime effect is the warning line and the tribes tests have no log capture to assert it against. --- .../catalina/tribes/membership/LocalStrings.properties | 1 + .../catalina/tribes/membership/StaticMembershipService.java | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/java/org/apache/catalina/tribes/membership/LocalStrings.properties b/java/org/apache/catalina/tribes/membership/LocalStrings.properties index 3e7b61cd54..a4224bdc6d 100644 --- a/java/org/apache/catalina/tribes/membership/LocalStrings.properties +++ b/java/org/apache/catalina/tribes/membership/LocalStrings.properties @@ -74,4 +74,5 @@ staticMembershipProvider.stopMembership.sendFailed=Unable to send stop membershi staticMembershipService.localMemberNotSet=The local member has not been resolved. Either start the channel with a level that includes the receiver or configure the local member explicitly. staticMembershipService.noLocalMember=There is no localMember in static member list. +staticMembershipService.propertiesWhileRunning=The properties were replaced while the membership provider is running. The running provider keeps the values it read when it started. staticMembershipService.stopFail=Unable to stop the static membership service, level: [{0}] diff --git a/java/org/apache/catalina/tribes/membership/StaticMembershipService.java b/java/org/apache/catalina/tribes/membership/StaticMembershipService.java index 841a49985a..85fc6b9ae0 100644 --- a/java/org/apache/catalina/tribes/membership/StaticMembershipService.java +++ b/java/org/apache/catalina/tribes/membership/StaticMembershipService.java @@ -263,8 +263,20 @@ public class StaticMembershipService extends MembershipServiceBase implements St properties.setProperty("pingInterval", String.valueOf(pingInterval)); } + /** + * Sets the properties for this service. The values are read when the membership provider is + * built, as the service starts. Replacing the properties while the service runs therefore has + * no effect on the running provider. It keeps the values it started with until the service is + * fully stopped and started again, even though the attribute getters of the service report the + * new values. + * + * @param properties the new configuration + */ @Override public void setProperties(Properties properties) { + if (provider != null) { + log.warn(sm.getString("staticMembershipService.propertiesWhileRunning")); + } setDefaults(properties); this.properties = properties; } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
