Search in sources :

Example 1 with ManagedAttribute

use of org.infinispan.jmx.annotations.ManagedAttribute in project infinispan by infinispan.

the class CacheMgmtInterceptor method getApproximateEntries.

@ManagedAttribute(description = "Approximate number of entries currently in the cache, including persisted and expired entries", displayName = "Approximate number of entries")
public long getApproximateEntries() {
    // Don't restrict the segments in case some writes used CACHE_MODE_LOCAL
    IntSet allSegments = IntSets.immutableRangeSet(cacheConfiguration.clustering().hash().numSegments());
    // Do restrict the segments when counting entries in shared stores
    IntSet writeSegments;
    if (distributionManager != null) {
        writeSegments = distributionManager.getCacheTopology().getLocalWriteSegments();
    } else {
        writeSegments = allSegments;
    }
    long persistenceSize = CompletionStages.join(approximatePersistenceSize(allSegments, writeSegments));
    return approximateTotalSize(persistenceSize, allSegments);
}
Also used : IntSet(org.infinispan.commons.util.IntSet) ManagedAttribute(org.infinispan.jmx.annotations.ManagedAttribute)

Example 2 with ManagedAttribute

use of org.infinispan.jmx.annotations.ManagedAttribute in project infinispan by infinispan.

the class CacheMgmtInterceptor method getApproximateEntriesUnique.

@ManagedAttribute(description = "Approximate number of entries currently in the cache for which the local node is a primary " + "owner, including persisted and expired entries", displayName = "Approximate number of entries owned as primary")
public long getApproximateEntriesUnique() {
    IntSet primarySegments;
    if (distributionManager != null) {
        LocalizedCacheTopology cacheTopology = distributionManager.getCacheTopology();
        primarySegments = cacheTopology.getLocalPrimarySegments();
    } else {
        primarySegments = IntSets.immutableRangeSet(cacheConfiguration.clustering().hash().numSegments());
    }
    long persistenceSize = CompletionStages.join(approximatePersistenceSize(primarySegments, primarySegments));
    return approximateTotalSize(persistenceSize, primarySegments);
}
Also used : IntSet(org.infinispan.commons.util.IntSet) LocalizedCacheTopology(org.infinispan.distribution.LocalizedCacheTopology) ManagedAttribute(org.infinispan.jmx.annotations.ManagedAttribute)

Example 3 with ManagedAttribute

use of org.infinispan.jmx.annotations.ManagedAttribute in project infinispan by infinispan.

the class DefaultCacheManager method getDefinedCacheNames.

@ManagedAttribute(description = "The defined cache names and their statuses.  The default cache is not included in this representation.", displayName = "List of defined caches", dataType = DataType.TRAIT)
public String getDefinedCacheNames() {
    StringJoiner stringJoiner = new StringJoiner("", "[", "]");
    cacheManagerInfo.getDefinedCaches().forEach(c -> stringJoiner.add(c.name).add(c.isStarted() ? "(created)" : "(not created)"));
    return stringJoiner.toString();
}
Also used : StringJoiner(java.util.StringJoiner) ManagedAttribute(org.infinispan.jmx.annotations.ManagedAttribute)

Example 4 with ManagedAttribute

use of org.infinispan.jmx.annotations.ManagedAttribute in project infinispan by infinispan.

the class LocalCacheStatus method getClusterAvailability.

@ManagedAttribute(description = "Cluster availability", displayName = "Cluster availability", dataType = DataType.TRAIT, writable = false)
public String getClusterAvailability() {
    AvailabilityMode clusterAvailability = AvailabilityMode.AVAILABLE;
    synchronized (runningCaches) {
        for (LocalCacheStatus cacheStatus : runningCaches.values()) {
            AvailabilityMode availabilityMode = cacheStatus.getPartitionHandlingManager().getAvailabilityMode();
            clusterAvailability = clusterAvailability.min(availabilityMode);
        }
    }
    return clusterAvailability.toString();
}
Also used : AvailabilityMode(org.infinispan.partitionhandling.AvailabilityMode) ManagedAttribute(org.infinispan.jmx.annotations.ManagedAttribute)

Example 5 with ManagedAttribute

use of org.infinispan.jmx.annotations.ManagedAttribute in project infinispan by infinispan.

the class DefaultCacheManager method getDefinedCacheConfigurationNames.

@ManagedAttribute(description = "The defined cache configuration names.", displayName = "List of defined cache configurations", dataType = DataType.TRAIT)
public String getDefinedCacheConfigurationNames() {
    StringJoiner stringJoiner = new StringJoiner(",", "[", "]");
    cacheManagerInfo.getCacheConfigurationNames().forEach(stringJoiner::add);
    return stringJoiner.toString();
}
Also used : StringJoiner(java.util.StringJoiner) ManagedAttribute(org.infinispan.jmx.annotations.ManagedAttribute)

Aggregations

ManagedAttribute (org.infinispan.jmx.annotations.ManagedAttribute)7 StringJoiner (java.util.StringJoiner)2 IntSet (org.infinispan.commons.util.IntSet)2 SingleThreadEventExecutor (io.netty.util.concurrent.SingleThreadEventExecutor)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 LocalizedCacheTopology (org.infinispan.distribution.LocalizedCacheTopology)1 ConsistentHash (org.infinispan.distribution.ch.ConsistentHash)1 AvailabilityMode (org.infinispan.partitionhandling.AvailabilityMode)1 CacheTopology (org.infinispan.topology.CacheTopology)1