Description
Here is the stack trace showing the thread that is making the call to the getMessageCount when a sub is unsubscribing. This causes unnecessary contention with message addition and can result is pauses. Is it really necessary?
ActiveMQ Transport: tcp:///127.0.0.1:54115 sun.misc.Unsafe.park at line #-2 java.util.concurrent.locks.LockSupport.park at line #186 java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt at line #834 java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued at line #867 java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire at line #1197 java.util.concurrent.locks.ReentrantReadWriteLock$WriteLock.lock at line #945 org.apache.activemq.store.kahadb.KahaDBStore$KahaDBTopicMessageStore.getMessageCount at line #782 org.apache.activemq.store.ProxyTopicMessageStore.getMessageCount at line #116 org.apache.activemq.broker.region.cursors.TopicStorePrefetch.getStoreSize at line #83 org.apache.activemq.broker.region.cursors.AbstractStoreCursor.resetSize at line #66 org.apache.activemq.broker.region.cursors.AbstractStoreCursor.gc at line #246 org.apache.activemq.broker.region.cursors.StoreDurableSubscriberCursor.stop at line #98 org.apache.activemq.broker.region.DurableTopicSubscription.deactivate at line #171 org.apache.activemq.broker.region.TopicRegion.removeConsumer at line #164 org.apache.activemq.broker.region.RegionBroker.removeConsumer at line #473 org.apache.activemq.broker.jmx.ManagedRegionBroker.removeConsumer at line #266 org.apache.activemq.broker.BrokerFilter.removeConsumer at line #117 org.apache.activemq.broker.BrokerFilter.removeConsumer at line #117 org.apache.activemq.broker.MutableBrokerFilter.removeConsumer at line #123 org.apache.activemq.broker.TransportConnection.processRemoveConsumer at line #580 org.apache.activemq.broker.TransportConnection.processRemoveSession at line #617 org.apache.activemq.command.RemoveInfo.visit at line #74 org.apache.activemq.broker.TransportConnection.service at line #291 org.apache.activemq.broker.TransportConnection$1.onCommand at line #149 org.apache.activemq.transport.MutexTransport.onCommand at line #50 org.apache.activemq.transport.WireFormatNegotiator.onCommand at line #113 org.apache.activemq.transport.AbstractInactivityMonitor.onCommand at line #229 org.apache.activemq.transport.TransportSupport.doConsume at line #83 org.apache.activemq.transport.tcp.TcpTransport.doRun at line #215 org.apache.activemq.transport.tcp.TcpTransport.run at line #197 java.lang.Thread.run at line #722