This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git
commit 2ce6f22e222578787d1e37e885c6092d87620746 Author: Alex Heneveld <[email protected]> AuthorDate: Wed Jan 19 16:51:07 2022 +0000 suppress stack trace on ConcurrentModficationException during serialization if it works on retry... --- .../brooklyn/core/mgmt/persist/RetryingMementoSerializer.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/org/apache/brooklyn/core/mgmt/persist/RetryingMementoSerializer.java b/core/src/main/java/org/apache/brooklyn/core/mgmt/persist/RetryingMementoSerializer.java index 480a2ec..0d46f37 100644 --- a/core/src/main/java/org/apache/brooklyn/core/mgmt/persist/RetryingMementoSerializer.java +++ b/core/src/main/java/org/apache/brooklyn/core/mgmt/persist/RetryingMementoSerializer.java @@ -20,6 +20,7 @@ package org.apache.brooklyn.core.mgmt.persist; import static com.google.common.base.Preconditions.checkNotNull; +import java.util.ConcurrentModificationException; import org.apache.brooklyn.api.mgmt.rebind.mementos.BrooklynMementoPersister.LookupContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -49,8 +50,14 @@ public class RetryingMementoSerializer<T> implements MementoSerializer<T> { LOG.info("Success following previous serialization error"); return result; } catch (RuntimeException e) { - LOG.warn("Error serializing memento (attempt "+attempt+" of "+maxAttempts+") for "+memento+ - "; expected sometimes if attribute value modified", e); + if (e.toString().contains(ConcurrentModificationException.class.getSimpleName())) { + // suppress stack trace in this common case + LOG.warn("Error serializing memento (attempt " + attempt + " of " + maxAttempts + ") for " + memento + + "; appears to be concurrent modification which is not unusual if other values are changing, and should be fixed after retry"); + } else { + LOG.warn("Error serializing memento (attempt " + attempt + " of " + maxAttempts + ") for " + memento + + "; expected sometimes if attribute value modified", e); + } lastException = e; } } while (attempt < maxAttempts);
