protected void recoverMessageStoreSubMetrics() throws IOException { if (isEnableSubscriptionStatistics()) { final MessageStoreSubscriptionStatistics statistics = getMessageStoreSubStatistics(); indexLock.writeLock().lock(); try {
protected void recoverMessageStoreSubMetrics() throws IOException { if (isEnableSubscriptionStatistics()) { final MessageStoreSubscriptionStatistics statistics = getMessageStoreSubStatistics(); indexLock.writeLock().lock(); try { pageFile.tx().execute(new Transaction.Closure<IOException>() { @Override public void execute(Transaction tx) throws IOException { StoredDestination sd = getStoredDestination(dest, tx); for (Iterator<Entry<String, KahaSubscriptionCommand>> iterator = sd.subscriptions .iterator(tx); iterator.hasNext();) { Entry<String, KahaSubscriptionCommand> entry = iterator.next(); String subscriptionKey = entry.getKey(); LastAck cursorPos = getLastAck(tx, sd, subscriptionKey); if (cursorPos != null) { long size = getStoredMessageSize(tx, sd, subscriptionKey); statistics.getMessageCount(subscriptionKey) .setCount(getStoredMessageCount(tx, sd, subscriptionKey)); statistics.getMessageSize(subscriptionKey).addSize(size > 0 ? size : 0); } } } }); } finally { indexLock.writeLock().unlock(); } } }
protected void recoverMessageStoreSubMetrics() throws IOException { if (isEnableSubscriptionStatistics()) { final MessageStoreSubscriptionStatistics statistics = getMessageStoreSubStatistics(); indexLock.writeLock().lock(); try { pageFile.tx().execute(new Transaction.Closure<IOException>() { @Override public void execute(Transaction tx) throws IOException { StoredDestination sd = getStoredDestination(dest, tx); for (Iterator<Entry<String, KahaSubscriptionCommand>> iterator = sd.subscriptions .iterator(tx); iterator.hasNext();) { Entry<String, KahaSubscriptionCommand> entry = iterator.next(); String subscriptionKey = entry.getKey(); LastAck cursorPos = getLastAck(tx, sd, subscriptionKey); if (cursorPos != null) { long size = getStoredMessageSize(tx, sd, subscriptionKey); statistics.getMessageCount(subscriptionKey) .setCount(getStoredMessageCount(tx, sd, subscriptionKey)); statistics.getMessageSize(subscriptionKey).addSize(size > 0 ? size : 0); } } } }); } finally { indexLock.writeLock().unlock(); } } }
protected void recoverMessageStoreSubMetrics() throws IOException { if (isEnableSubscriptionStatistics()) { final MessageStoreSubscriptionStatistics statistics = getMessageStoreSubStatistics(); indexLock.writeLock().lock(); try { pageFile.tx().execute(new Transaction.Closure<IOException>() { @Override public void execute(Transaction tx) throws IOException { StoredDestination sd = getStoredDestination(dest, tx); for (Iterator<Entry<String, KahaSubscriptionCommand>> iterator = sd.subscriptions .iterator(tx); iterator.hasNext();) { Entry<String, KahaSubscriptionCommand> entry = iterator.next(); String subscriptionKey = entry.getKey(); LastAck cursorPos = getLastAck(tx, sd, subscriptionKey); if (cursorPos != null) { long size = getStoredMessageSize(tx, sd, subscriptionKey); statistics.getMessageCount(subscriptionKey) .setCount(getStoredMessageCount(tx, sd, subscriptionKey)); statistics.getMessageSize(subscriptionKey).addSize(size > 0 ? size : 0); } } } }); } finally { indexLock.writeLock().unlock(); } } }