}
} else if (brokerStats) {
ActiveMQMapMessage statsMessage = new ActiveMQMapMessage();
BrokerService brokerService = getBrokerService();
RegionBroker regionBroker = (RegionBroker) brokerService.getRegionBroker();
SystemUsage systemUsage = brokerService.getSystemUsage();
DestinationStatistics stats = regionBroker.getDestinationStatistics();
statsMessage.setString("brokerName", regionBroker.getBrokerName());
statsMessage.setString("brokerId", regionBroker.getBrokerId().toString());
statsMessage.setLong("size", stats.getMessages().getCount());
statsMessage.setLong("enqueueCount", stats.getEnqueues().getCount());
statsMessage.setLong("dequeueCount", stats.getDequeues().getCount());
statsMessage.setLong("dispatchCount", stats.getDispatched().getCount());
statsMessage.setLong("expiredCount", stats.getExpired().getCount());
statsMessage.setLong("inflightCount", stats.getInflight().getCount());
statsMessage.setLong("messagesCached", stats.getMessagesCached().getCount());
statsMessage.setInt("memoryPercentUsage", systemUsage.getMemoryUsage().getPercentUsage());
statsMessage.setLong("memoryUsage", systemUsage.getMemoryUsage().getUsage());
statsMessage.setLong("memoryLimit", systemUsage.getMemoryUsage().getLimit());
statsMessage.setInt("storePercentUsage", systemUsage.getStoreUsage().getPercentUsage());
statsMessage.setLong("storeUsage", systemUsage.getStoreUsage().getUsage());
statsMessage.setLong("storeLimit", systemUsage.getStoreUsage().getLimit());
statsMessage.setInt("tempPercentUsage", systemUsage.getTempUsage().getPercentUsage());
statsMessage.setLong("tempUsage", systemUsage.getTempUsage().getUsage());
statsMessage.setLong("tempLimit", systemUsage.getTempUsage().getLimit());
statsMessage.setDouble("averageEnqueueTime", stats.getProcessTime().getAverageTime());
statsMessage.setDouble("maxEnqueueTime", stats.getProcessTime().getMaxTime());
statsMessage.setDouble("minEnqueueTime", stats.getProcessTime().getMinTime());
statsMessage.setLong("consumerCount", stats.getConsumers().getCount());
statsMessage.setLong("producerCount", stats.getProducers().getCount());