Search in sources :

Example 6 with LocalQueueStatsImpl

use of com.hazelcast.monitor.impl.LocalQueueStatsImpl in project hazelcast by hazelcast.

the class ContainsOperation method afterRun.

@Override
public void afterRun() throws Exception {
    LocalQueueStatsImpl stats = getQueueService().getLocalQueueStatsImpl(name);
    stats.incrementOtherOperations();
}
Also used : LocalQueueStatsImpl(com.hazelcast.monitor.impl.LocalQueueStatsImpl)

Example 7 with LocalQueueStatsImpl

use of com.hazelcast.monitor.impl.LocalQueueStatsImpl in project hazelcast by hazelcast.

the class OfferOperation method afterRun.

@Override
public void afterRun() throws Exception {
    LocalQueueStatsImpl stats = getQueueService().getLocalQueueStatsImpl(name);
    if (Boolean.TRUE.equals(response)) {
        stats.incrementOffers();
        publishEvent(ItemEventType.ADDED, data);
    } else {
        stats.incrementRejectedOffers();
    }
}
Also used : LocalQueueStatsImpl(com.hazelcast.monitor.impl.LocalQueueStatsImpl)

Example 8 with LocalQueueStatsImpl

use of com.hazelcast.monitor.impl.LocalQueueStatsImpl in project hazelcast by hazelcast.

the class QueueService method createLocalQueueStats.

/**
     * Returns the local queue statistics for the given name and partition ID. If this node is the owner for the partition,
     * returned stats contain {@link LocalQueueStats#getOwnedItemCount()}, otherwise it contains
     * {@link LocalQueueStats#getBackupItemCount()}.
     *
     * @param name        the name of the queue for which the statistics are returned
     * @param partitionId the partition ID for which the statistics are returned
     * @return the statistics
     */
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();
    IPartition partition = nodeEngine.getPartitionService().getPartition(partitionId);
    Address owner = partition.getOwnerOrNull();
    if (thisAddress.equals(owner)) {
        stats.setOwnedItemCount(container.size());
    } else if (owner != null) {
        stats.setBackupItemCount(container.backupSize());
    }
    container.setStats(stats);
    return stats;
}
Also used : Address(com.hazelcast.nio.Address) LocalQueueStatsImpl(com.hazelcast.monitor.impl.LocalQueueStatsImpl) IPartition(com.hazelcast.spi.partition.IPartition)

Example 9 with LocalQueueStatsImpl

use of com.hazelcast.monitor.impl.LocalQueueStatsImpl in project hazelcast by hazelcast.

the class PeekOperation method afterRun.

@Override
public void afterRun() throws Exception {
    LocalQueueStatsImpl stats = getQueueService().getLocalQueueStatsImpl(name);
    stats.incrementOtherOperations();
}
Also used : LocalQueueStatsImpl(com.hazelcast.monitor.impl.LocalQueueStatsImpl)

Example 10 with LocalQueueStatsImpl

use of com.hazelcast.monitor.impl.LocalQueueStatsImpl in project hazelcast by hazelcast.

the class PollOperation method afterRun.

@Override
public void afterRun() throws Exception {
    LocalQueueStatsImpl stats = getQueueService().getLocalQueueStatsImpl(name);
    if (response != null) {
        stats.incrementPolls();
        publishEvent(ItemEventType.REMOVED, item.getData());
    } else {
        stats.incrementEmptyPolls();
    }
}
Also used : LocalQueueStatsImpl(com.hazelcast.monitor.impl.LocalQueueStatsImpl)

Aggregations

LocalQueueStatsImpl (com.hazelcast.monitor.impl.LocalQueueStatsImpl)17 Data (com.hazelcast.nio.serialization.Data)4 Address (com.hazelcast.nio.Address)1 IPartition (com.hazelcast.spi.partition.IPartition)1