Search in sources :

Example 6 with LocalQueueStatsImpl

use of com.hazelcast.internal.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.internal.monitor.impl.LocalQueueStatsImpl)

Example 7 with LocalQueueStatsImpl

use of com.hazelcast.internal.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.internal.monitor.impl.LocalQueueStatsImpl)

Example 8 with LocalQueueStatsImpl

use of com.hazelcast.internal.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 = partitionService.getPartition(partitionId, false);
    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.cluster.Address) LocalQueueStatsImpl(com.hazelcast.internal.monitor.impl.LocalQueueStatsImpl) IPartition(com.hazelcast.internal.partition.IPartition)

Example 9 with LocalQueueStatsImpl

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

the class DrainOperation method afterRun.

@Override
public void afterRun() throws Exception {
    LocalQueueStatsImpl stats = getQueueService().getLocalQueueStatsImpl(name);
    stats.incrementOtherOperations();
    for (Data data : dataMap.values()) {
        publishEvent(ItemEventType.REMOVED, data);
    }
}
Also used : LocalQueueStatsImpl(com.hazelcast.internal.monitor.impl.LocalQueueStatsImpl) Data(com.hazelcast.internal.serialization.Data)

Example 10 with LocalQueueStatsImpl

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

the class IteratorOperation method afterRun.

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

Aggregations

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