[ 
https://issues.apache.org/jira/browse/ARTEMIS-5694?focusedWorklogId=986315&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-986315
 ]

ASF GitHub Bot logged work on ARTEMIS-5694:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 08/Oct/25 13:32
            Start Date: 08/Oct/25 13:32
    Worklog Time Spent: 10m 
      Work Description: clebertsuconic commented on code in PR #5952:
URL: https://github.com/apache/activemq-artemis/pull/5952#discussion_r2413877836


##########
artemis-commons/src/main/java/org/apache/activemq/artemis/utils/critical/CriticalAnalyzerImpl.java:
##########
@@ -49,28 +52,53 @@ public CriticalAnalyzerImpl() {
        *  otherwise in case of a deadlock, or a starvation of the server the 
analyzer won't pick up any
        *  issues and won't be able to shutdown the server or halt the VM
        */
-      this.scheduledComponent = new ActiveMQScheduledComponent(null, null, 
checkTimeNanoSeconds, TimeUnit.NANOSECONDS, false) {
+      this.scheduledComponent = new CriticalAnalyzerScheduledComponent(this, 
null, null, checkTimeNanoSeconds, checkTimeNanoSeconds, TimeUnit.NANOSECONDS, 
false);
 
-         @Override
-         public void run() {
-            logger.trace("Checking critical analyzer");
-            check();
-         }
+   }
 
-         @Override
-         protected ActiveMQThreadFactory getThreadFactory() {
-            return new ActiveMQThreadFactory("critical-analyzer", true, 
getThisClassLoader());
-         }
+   private static class CriticalAnalyzerScheduledComponent extends 
ActiveMQScheduledComponent {
 
-         private ClassLoader getThisClassLoader() {
-            return 
AccessController.doPrivileged((PrivilegedAction<ClassLoader>) () -> 
CriticalAnalyzerImpl.this.getClass().getClassLoader());
+      private final CriticalAnalyzerImpl criticalAnalyzer;
 
-         }
+      public CriticalAnalyzerScheduledComponent(CriticalAnalyzerImpl 
criticalAnalyzer,
+                                                ScheduledExecutorService 
scheduledExecutorService,
+                                                Executor executor,
+                                                long initialDelay,
+                                                long checkPeriod,
+                                                TimeUnit timeUnit,
+                                                boolean onDemand) {
+         super(scheduledExecutorService, executor, initialDelay, checkPeriod, 
timeUnit, onDemand);
+         this.criticalAnalyzer = criticalAnalyzer;
+      }
+
+
+      @Override
+      public void run() {
+         logger.trace("Checking critical analyzer");
+         criticalAnalyzer.check();
+      }
+
+      @Override
+      protected ActiveMQThreadFactory getThreadFactory() {
+         return new ActiveMQThreadFactory("critical-analyzer", true, 
getThisClassLoader());
+      }
+
+      private ClassLoader getThisClassLoader() {
+         return AccessController.doPrivileged((PrivilegedAction<ClassLoader>) 
() -> criticalAnalyzer.getClass().getClassLoader());
+      }
+
+      /** Schedule an action to kick in the critical analyzer.
+       *  If this future is not cancelled in time, the critical analyzer will 
kick in. */
+      public ScheduledFuture<?> kickIt(CriticalComponent component) {
+         return scheduledExecutorService.schedule(() -> {
+            criticalAnalyzer.fireActions(component);
+         }, period, timeUnit);
+      }

Review Comment:
   I liked the idea... although I used the simple extension points we already 
have. just had the Session to implement CriticalComponent





Issue Time Tracking
-------------------

    Worklog Id:     (was: 986315)
    Time Spent: 1.5h  (was: 1h 20m)

> Lingering sessions after a storage timeout
> ------------------------------------------
>
>                 Key: ARTEMIS-5694
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-5694
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>    Affects Versions: 2.42.0
>            Reporter: Clebert Suconic
>            Assignee: Clebert Suconic
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 2.43.0
>
>          Time Spent: 1.5h
>  Remaining Estimate: 0h
>
> We had reports of sessions not closing for an unkown situation, probably on 
> storage.
> I am adding a timeout verification and adding extra logs in case this happens.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact


Reply via email to