From 92d88ca699cd8090a26b92cbe46789d2b848195f Mon Sep 17 00:00:00 2001
From: Valery Kharseko <vharseko@3a-systems.ru>
Date: Mon, 07 Sep 2026 09:30:36 +0000
Subject: [PATCH] [#889] Keep a change the replay could not apply out of the ServerState (#892)
---
opendj-server-legacy/src/test/java/org/opends/server/extensions/DummyAlertHandler.java | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/extensions/DummyAlertHandler.java b/opendj-server-legacy/src/test/java/org/opends/server/extensions/DummyAlertHandler.java
index 181b691..f395262 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/extensions/DummyAlertHandler.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/extensions/DummyAlertHandler.java
@@ -13,10 +13,13 @@
*
* Copyright 2008 Sun Microsystems, Inc.
* Portions Copyright 2014-2016 ForgeRock AS.
+ * Portions Copyright 2026 3A Systems, LLC.
*/
package org.opends.server.extensions;
import java.util.List;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.atomic.AtomicInteger;
import org.forgerock.i18n.LocalizableMessage;
@@ -42,6 +45,9 @@
/** The number of times this alert handler has been invoked. */
private static AtomicInteger alertCount = new AtomicInteger(0);
+ /** The number of times this alert handler has been invoked, per alert type. */
+ private static final ConcurrentMap<String, AtomicInteger> alertCountByType = new ConcurrentHashMap<>();
+
/** Creates a new instance of this SMTP alert handler. */
public DummyAlertHandler()
{
@@ -86,6 +92,7 @@
LocalizableMessage alertMessage)
{
alertCount.incrementAndGet();
+ alertCountByType.computeIfAbsent(alertType, type -> new AtomicInteger()).incrementAndGet();
}
/**
@@ -98,6 +105,21 @@
return alertCount.get();
}
+ /**
+ * Retrieves the number of times that this alert handler has been invoked with the
+ * provided alert type.
+ *
+ * @param alertType The type of the alert notifications to count.
+ *
+ * @return The number of times that this alert handler has been given an alert
+ * notification of that type.
+ */
+ public static int getAlertCount(String alertType)
+ {
+ final AtomicInteger count = alertCountByType.get(alertType);
+ return count != null ? count.get() : 0;
+ }
+
/** {@inheritDoc} */
@Override
public boolean isConfigurationChangeAcceptable(AlertHandlerCfg configuration,
--
Gitblit v1.10.0