clebertsuconic commented on code in PR #4418:
URL: https://github.com/apache/activemq-artemis/pull/4418#discussion_r1159746076
##########
artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/RefCountMessage.java:
##########
@@ -16,13 +16,109 @@
*/
package org.apache.activemq.artemis.api.core;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.lang.invoke.MethodHandles;
+import java.time.Instant;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
-// import org.apache.activemq.artemis.utils.collections.ConcurrentHashSet; --
#ifdef DEBUG
+import org.apache.activemq.artemis.core.client.ActiveMQClientLogger;
+import org.apache.activemq.artemis.utils.ObjectCleaner;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.helpers.MessageFormatter;
public class RefCountMessage {
+ /** If you define a logger named
org.apache.activemq.artemis.api.core.RefCountMessage.REF_DEBUG at at least
DEBUG level
+ you will see logging output when this object is released without being
accounted for. */
+ private static final Logger refLogger =
LoggerFactory.getLogger(MethodHandles.lookup().lookupClass().getName() +
".REF_DEBUG");
+
+ public static boolean isDebugEnabled() {
+ return refLogger.isDebugEnabled();
+ }
+
+ /** Sub classes constructors willing to debug reference counts,
+ * can register the objectCleaner through this method. */
+ protected void registerDebug() {
+ if (debugStatus == null) {
+ debugStatus = new DebugState(this.toString());
+ ObjectCleaner.register(this, debugStatus);
+ }
+ }
+
+ public static boolean isTraceEnabled() {
+ return refLogger.isTraceEnabled();
+ }
Review Comment:
funny, I actually just renamed these methods as isRefDebugEnabled and
isRefTraceEnabled without reading this comment.
--
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]