public NodeEngine getNodeEngine() {
return nodeEngine;
}
public LocalQueueStats createLocalQueueStats(String name, int partitionId) {
LocalQueueStatsImpl stats = getLocalQueueStatsImpl(name);
stats.setOwnedItemCount(0);
stats.setBackupItemCount(0);
QueueContainer container = containerMap.get(name);
if (container == null) {
return stats;
}
Address thisAddress = nodeEngine.getClusterService().getThisAddress();
InternalPartition partition = nodeEngine.getPartitionService().getPartition(partitionId);
Address owner = partition.getOwner();
if (owner == null) {
//no-op because the owner is not yet set.
} else if (thisAddress.equals(owner)) {
stats.setOwnedItemCount(container.size());
} else {
stats.setBackupItemCount(container.backupSize());
}
container.setStats(stats);
return stats;
}