protected void incrementAndAddSizeToStoreStat(String kahaDestKey, String subKey, long size) { if (enableSubscriptionStatistics) { MessageStoreSubscriptionStatistics subStats = getSubStats(kahaDestKey); if (subStats != null && subKey != null) { subStats.getMessageCount(subKey).increment(); if (size > 0) { subStats.getMessageSize(subKey).addSize(size); } } } }
public CountStatisticImpl getMessageCount(String subKey) { return getOrInitStatistics(subKey).getMessageCount(); }
/** * Clear the counter for the destination, if one exists. * * @param kahaDestination */ protected void clearStoreStats(KahaDestination kahaDestination) { String key = key(kahaDestination); MessageStoreStatistics storeStats = getStoreStats(key); MessageStoreSubscriptionStatistics subStats = getSubStats(key); if (storeStats != null) { storeStats.reset(); } if (subStats != null) { subStats.reset(); } }
@Override public int getMessageCount(String clientId, String subscriptionName) throws IOException { final String subscriptionKey = subscriptionKey(clientId, subscriptionName); if (isEnableSubscriptionStatistics()) { return (int)this.messageStoreSubStats.getMessageCount(subscriptionKey).getCount(); } else { indexLock.writeLock().lock(); try { return pageFile.tx().execute(new Transaction.CallableClosure<Integer, IOException>() { @Override public Integer execute(Transaction tx) throws IOException { StoredDestination sd = getStoredDestination(dest, tx); LastAck cursorPos = getLastAck(tx, sd, subscriptionKey); if (cursorPos == null) { // The subscription might not exist. return 0; } return (int) getStoredMessageCount(tx, sd, subscriptionKey); } }); } finally { indexLock.writeLock().unlock(); } } }
@Override public long getMessageSize(String clientId, String subscriptionName) throws IOException { final String subscriptionKey = subscriptionKey(clientId, subscriptionName); if (isEnableSubscriptionStatistics()) { return this.messageStoreSubStats.getMessageSize(subscriptionKey).getTotalSize(); } else { indexLock.writeLock().lock(); try { return pageFile.tx().execute(new Transaction.CallableClosure<Long, IOException>() { @Override public Long execute(Transaction tx) throws IOException { StoredDestination sd = getStoredDestination(dest, tx); LastAck cursorPos = getLastAck(tx, sd, subscriptionKey); if (cursorPos == null) { // The subscription might not exist. return 0l; } return getStoredMessageSize(tx, sd, subscriptionKey); } }); } finally { indexLock.writeLock().unlock(); } } }
MessageStoreSubscriptionStatistics subStats = getSubStats(key(command.getDestination())); if (subStats != null) { subStats.removeSubscription(subscriptionKey);
@Override public int getMessageCount(String clientId, String subscriptionName) throws IOException { final String subscriptionKey = subscriptionKey(clientId, subscriptionName); if (isEnableSubscriptionStatistics()) { return (int)this.messageStoreSubStats.getMessageCount(subscriptionKey).getCount(); } else { indexLock.writeLock().lock(); try { return pageFile.tx().execute(new Transaction.CallableClosure<Integer, IOException>() { @Override public Integer execute(Transaction tx) throws IOException { StoredDestination sd = getStoredDestination(dest, tx); LastAck cursorPos = getLastAck(tx, sd, subscriptionKey); if (cursorPos == null) { // The subscription might not exist. return 0; } return (int) getStoredMessageCount(tx, sd, subscriptionKey); } }); } finally { indexLock.writeLock().unlock(); } } }
@Override public long getMessageSize(String clientId, String subscriptionName) throws IOException { final String subscriptionKey = subscriptionKey(clientId, subscriptionName); if (isEnableSubscriptionStatistics()) { return this.messageStoreSubStats.getMessageSize(subscriptionKey).getTotalSize(); } else { indexLock.writeLock().lock(); try { return pageFile.tx().execute(new Transaction.CallableClosure<Long, IOException>() { @Override public Long execute(Transaction tx) throws IOException { StoredDestination sd = getStoredDestination(dest, tx); LastAck cursorPos = getLastAck(tx, sd, subscriptionKey); if (cursorPos == null) { // The subscription might not exist. return 0l; } return getStoredMessageSize(tx, sd, subscriptionKey); } }); } finally { indexLock.writeLock().unlock(); } } }
MessageStoreSubscriptionStatistics subStats = getSubStats(key(command.getDestination())); if (subStats != null) { subStats.removeSubscription(subscriptionKey);
protected void decrementAndSubSizeToStoreStat(String kahaDestKey, String subKey, long size) { if (enableSubscriptionStatistics) { MessageStoreSubscriptionStatistics subStats = getSubStats(kahaDestKey); if (subStats != null && subKey != null) { subStats.getMessageCount(subKey).decrement(); if (size > 0) { subStats.getMessageSize(subKey).addSize(-size); } } } }
public SizeStatisticImpl getMessageSize(String subKey) { return getOrInitStatistics(subKey).getMessageSize(); }
@Override public int getMessageCount(String clientId, String subscriptionName) throws IOException { final String subscriptionKey = subscriptionKey(clientId, subscriptionName); if (isEnableSubscriptionStatistics()) { return (int)this.messageStoreSubStats.getMessageCount(subscriptionKey).getCount(); } else { indexLock.writeLock().lock(); try { return pageFile.tx().execute(new Transaction.CallableClosure<Integer, IOException>() { @Override public Integer execute(Transaction tx) throws IOException { StoredDestination sd = getStoredDestination(dest, tx); LastAck cursorPos = getLastAck(tx, sd, subscriptionKey); if (cursorPos == null) { // The subscription might not exist. return 0; } return (int) getStoredMessageCount(tx, sd, subscriptionKey); } }); } finally { indexLock.writeLock().unlock(); } } }
@Override public long getMessageSize(String clientId, String subscriptionName) throws IOException { final String subscriptionKey = subscriptionKey(clientId, subscriptionName); if (isEnableSubscriptionStatistics()) { return this.messageStoreSubStats.getMessageSize(subscriptionKey).getTotalSize(); } else { indexLock.writeLock().lock(); try { return pageFile.tx().execute(new Transaction.CallableClosure<Long, IOException>() { @Override public Long execute(Transaction tx) throws IOException { StoredDestination sd = getStoredDestination(dest, tx); LastAck cursorPos = getLastAck(tx, sd, subscriptionKey); if (cursorPos == null) { // The subscription might not exist. return 0l; } return getStoredMessageSize(tx, sd, subscriptionKey); } }); } finally { indexLock.writeLock().unlock(); } } }
/** * Clear the counter for the destination, if one exists. * * @param kahaDestination */ protected void clearStoreStats(KahaDestination kahaDestination) { String key = key(kahaDestination); MessageStoreStatistics storeStats = getStoreStats(key); MessageStoreSubscriptionStatistics subStats = getSubStats(key); if (storeStats != null) { storeStats.reset(); } if (subStats != null) { subStats.reset(); } }
MessageStoreSubscriptionStatistics subStats = getSubStats(key(command.getDestination())); if (subStats != null) { subStats.removeSubscription(subscriptionKey);
public void removeSubscription(String subKey) { SubscriptionStatistics subStats = subStatistics.remove(subKey); //Subtract from the parent if (subStats != null) { getMessageCount().subtract(subStats.getMessageCount().getCount()); getMessageSize().addSize(-subStats.getMessageSize().getTotalSize()); } }
public SizeStatisticImpl getMessageSize(String subKey) { return getOrInitStatistics(subKey).getMessageSize(); }
@Override public int getMessageCount(String clientId, String subscriptionName) throws IOException { final String subscriptionKey = subscriptionKey(clientId, subscriptionName); if (isEnableSubscriptionStatistics()) { return (int)this.messageStoreSubStats.getMessageCount(subscriptionKey).getCount(); } else { indexLock.writeLock().lock(); try { return pageFile.tx().execute(new Transaction.CallableClosure<Integer, IOException>() { @Override public Integer execute(Transaction tx) throws IOException { StoredDestination sd = getStoredDestination(dest, tx); LastAck cursorPos = getLastAck(tx, sd, subscriptionKey); if (cursorPos == null) { // The subscription might not exist. return 0; } return (int) getStoredMessageCount(tx, sd, subscriptionKey); } }); } finally { indexLock.writeLock().unlock(); } } }
@Override public long getMessageSize(String clientId, String subscriptionName) throws IOException { final String subscriptionKey = subscriptionKey(clientId, subscriptionName); if (isEnableSubscriptionStatistics()) { return this.messageStoreSubStats.getMessageSize(subscriptionKey).getTotalSize(); } else { indexLock.writeLock().lock(); try { return pageFile.tx().execute(new Transaction.CallableClosure<Long, IOException>() { @Override public Long execute(Transaction tx) throws IOException { StoredDestination sd = getStoredDestination(dest, tx); LastAck cursorPos = getLastAck(tx, sd, subscriptionKey); if (cursorPos == null) { // The subscription might not exist. return 0l; } return getStoredMessageSize(tx, sd, subscriptionKey); } }); } finally { indexLock.writeLock().unlock(); } } }
/** * Clear the counter for the destination, if one exists. * * @param kahaDestination */ protected void clearStoreStats(KahaDestination kahaDestination) { String key = key(kahaDestination); MessageStoreStatistics storeStats = getStoreStats(key); MessageStoreSubscriptionStatistics subStats = getSubStats(key); if (storeStats != null) { storeStats.reset(); } if (subStats != null) { subStats.reset(); } }