brusdev commented on code in PR #5952:
URL: https://github.com/apache/activemq-artemis/pull/5952#discussion_r2408029887


##########
artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java:
##########
@@ -1777,37 +1787,56 @@ public void close(final boolean failed) {
    @Override
    public void close(final boolean failed, final boolean force) {
       synchronized (this) {
-         if (closed) {
+         if (closing) {
             return;
          }
-         closed = true;
+         closing = true;
       }
 
       if (force) {
          context.reset();
       }
 
+      final ScheduledFuture<?> scheduledFuture;
+      if (server.getConfiguration().getCloseTimeout() > 0) {
+         scheduledFuture = server.getScheduledPool().schedule(() -> {
+            long txID = tx != null ? tx.getID() : -1L;
+
+            ActiveMQServerLogger.LOGGER.sessionCloseTimeout(name, 
server.getConfiguration().getCloseTimeout(), consumers.size(), txID, 
remotingConnection, ThreadDumpUtil.threadDump());
+
+            callDoClose(failed);

Review Comment:
   Resetting the context should avoid to execute pending tasks and free linked 
resources.



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


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