clebertsuconic commented on code in PR #4418:
URL: https://github.com/apache/activemq-artemis/pull/4418#discussion_r1151264320


##########
artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/RefCountMessage.java:
##########
@@ -49,6 +76,28 @@ public int getDurableCount() {
       return DURABLE_REF_COUNT_UPDATER.get(this);
    }
 
+   /** Sub classes may mark fired=true when they were explicitly called.
+    * E.g large message removed the file upon cancellation */
+   protected void markFired() {
+      fired = true;
+      if (firedAtomic != null) {
+         firedAtomic.set(true);
+      }
+   }
+
+   public RefCountMessage() {
+      if (DEBUG_REF_COUNT) {
+         AtomicBoolean refFired = this.firedAtomic;
+         List<Exception> crumbs = debugCrumbs;
+         crumbs.add(new Exception("new Instance"));
+         String clazz = this.getClass().getName();
+         // notice you can't have a direct reference on the LargeMessage 
Itself,
+         // Otherwise you would get a leak from itself
+         // RefCountMessageLeakTest is validating this scenario
+         CLEANER.register(this, () -> debug(clazz, refFired, crumbs));

Review Comment:
   I actually amended this with a State Object.



##########
artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/Test.java:
##########


Review Comment:
   removed... it was a mistake.



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