@Override protected synchronized void onLoad(ListNode<String, Location> node, Transaction tx) { try { Iterator<Entry<String, Location>> i = node.iterator(tx); while (i.hasNext()) { messageSize.addSize(i.next().getValue().getSize()); } } catch (IOException e) { LOG.warn("could not increment message size", e); } }
public OrderedPendingList() { messageSize = new SizeStatisticImpl("messageSize", "The size in bytes of the pending messages"); messageSize.setEnabled(true); pendingMessageHelper = new PendingMessageHelper(map, messageSize); }
@Override protected synchronized void appendFieldDescription(StringBuffer buffer) { buffer.append(" count: "); buffer.append(Long.toString(count)); buffer.append(" maxSize: "); buffer.append(Long.toString(maxSize)); buffer.append(" minSize: "); buffer.append(Long.toString(minSize)); buffer.append(" totalSize: "); buffer.append(Long.toString(totalSize)); buffer.append(" averageSize: "); buffer.append(Double.toString(getAverageSize())); buffer.append(" averageTimeExMinMax: "); buffer.append(Double.toString(getAveragePerSecondExcludingMinMax())); buffer.append(" averagePerSecond: "); buffer.append(Double.toString(getAveragePerSecond())); buffer.append(" averagePerSecondExMinMax: "); buffer.append(Double.toString(getAveragePerSecondExcludingMinMax())); super.appendFieldDescription(buffer); } }
@Override public void writePayload(final MessageStoreStatistics object, final DataOutput dataOut) throws IOException { dataOut.writeBoolean(null != object); if (object != null) { dataOut.writeLong(object.getMessageCount().getCount()); dataOut.writeLong(object.getMessageSize().getTotalSize()); dataOut.writeLong(object.getMessageSize().getMaxSize()); dataOut.writeLong(object.getMessageSize().getMinSize()); dataOut.writeLong(object.getMessageSize().getCount()); } }
recoveredStatistics.getMessageCount().subtract(ackedAndPrepared.size()); getMessageStoreStatistics().getMessageCount().setCount(recoveredStatistics.getMessageCount().getCount()); getMessageStoreStatistics().getMessageSize().setTotalSize(recoveredStatistics.getMessageSize().getTotalSize()); } finally { indexLock.writeLock().unlock();
@Override public void clear() { this.root = null; this.tail = null; this.map.clear(); this.messageSize.reset(); }
/** * @return the max size of a message (bytes) */ public long getMaxMessageSize() { return destination.getDestinationStatistics().getMessageSize().getMaxSize(); }
/** * @return the min size of a message (bytes) */ public long getMinMessageSize() { return destination.getDestinationStatistics().getMessageSize().getMinSize(); }
/** * @return the average number of steps per second */ public double getAveragePerSecond() { double d = 1000; double averageSize = getAverageSize(); if (averageSize == 0) { return 0; } return d / averageSize; }
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()); } }
@Override public long messageSize() { return messageSize.getTotalSize(); }
public void setEnabled(boolean enabled) { super.setEnabled(enabled); messageCount.setEnabled(enabled); messageSize.setEnabled(enabled); }
protected AbstractMessageStoreStatistics(boolean enabled, String countDescription, String sizeDescription) { messageCount = new CountStatisticImpl("messageCount", countDescription); messageSize = new SizeStatisticImpl("messageSize", sizeDescription); addStatistic("messageCount", messageCount); addStatistic("messageSize", messageSize); this.setEnabled(enabled); }
@Override public MessageStoreStatistics readPayload(final DataInput dataIn) throws IOException { if (!dataIn.readBoolean()) { return null; } MessageStoreStatistics messageStoreStatistics = new MessageStoreStatistics(); messageStoreStatistics.getMessageCount().setCount(dataIn.readLong()); messageStoreStatistics.getMessageSize().setTotalSize(dataIn.readLong()); messageStoreStatistics.getMessageSize().setMaxSize(dataIn.readLong()); messageStoreStatistics.getMessageSize().setMinSize(dataIn.readLong()); messageStoreStatistics.getMessageSize().setCount(dataIn.readLong()); return messageStoreStatistics; } }
@Override public void recoverMessageStoreStatistics() throws IOException { synchronized (messageTable) { long size = 0; int count = 0; for (Message message : messageTable.values()) { size += message.getSize(); } getMessageStoreStatistics().reset(); getMessageStoreStatistics().getMessageCount().setCount(count); getMessageStoreStatistics().getMessageSize().setTotalSize(size); } }
getMessageStoreStatistics().getMessageSize().setTotalSize(recoveredStatistics.getMessageSize().getTotalSize()); } finally { indexLock.writeLock().unlock();
@Override public synchronized void clear(Transaction tx) throws IOException { messageSize.reset(); super.clear(tx); }
/** * @return the max size of a message (bytes) */ @Override public long getMaxMessageSize() { return destination.getDestinationStatistics().getMessageSize().getMaxSize(); }
/** * @return the min size of a message (bytes) */ @Override public long getMinMessageSize() { return destination.getDestinationStatistics().getMessageSize().getMinSize(); }
/** * @return the average size of a message (bytes) */ public double getAverageMessageSize() { return destination.getDestinationStatistics().getMessageSize().getAverageSize(); }