Search in sources :

Example 1 with ManagedOperation

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

the class GlobalSecurityManagerImpl method flushGlobalACLCache.

@ManagedOperation(name = "Flush ACL Cache", displayName = "Flush ACL Cache", description = "Flushes the global ACL cache across the entire cluster")
@Override
public CompletionStage<Void> flushGlobalACLCache() {
    if (cacheEnabled) {
        ClusterExecutor executor = SecurityActions.getClusterExecutor(embeddedCacheManager);
        return executor.submitConsumer(cm -> {
            GlobalSecurityManager globalSecurityManager = SecurityActions.getGlobalComponentRegistry(cm).getComponent(GlobalSecurityManager.class);
            ((GlobalSecurityManagerImpl) globalSecurityManager).flushGlobalACLCache0();
            return null;
        }, (a, v, t) -> {
        });
    } else {
        return CompletableFutures.completedNull();
    }
}
Also used : GlobalSecurityManager(org.infinispan.security.GlobalSecurityManager) ClusterExecutor(org.infinispan.manager.ClusterExecutor) ManagedOperation(org.infinispan.jmx.annotations.ManagedOperation)

Example 2 with ManagedOperation

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

the class DistributionManagerImpl method isAffectedByRehash.

@Override
@ManagedOperation(description = "Determines whether a given key is affected by an ongoing rehash, if any.", displayName = "Could key be affected by rehash?")
public boolean isAffectedByRehash(@Parameter(name = "key", description = "Key to check") Object key) {
    if (!isRehashInProgress())
        return false;
    int segment = keyPartitioner.getSegment(key);
    DistributionInfo distributionInfo = this.extendedTopology.getDistribution(segment);
    return distributionInfo.isWriteOwner() && !distributionInfo.isReadOwner();
}
Also used : DistributionInfo(org.infinispan.distribution.DistributionInfo) ManagedOperation(org.infinispan.jmx.annotations.ManagedOperation)

Example 3 with ManagedOperation

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

the class ExtendedStatisticInterceptor method dumpStatisticToFile.

@ManagedOperation(description = "Dumps the current cache statistic values to a file", displayName = "Dump cache Statistics to file")
public final void dumpStatisticToFile(@Parameter(description = "The file path") String filePath) throws IOException {
    PrintStream stream = null;
    try {
        stream = new PrintStream(new File(filePath));
        cacheStatisticManager.dumpCacheStatisticsTo(stream);
    } finally {
        if (stream != null) {
            stream.close();
        }
    }
}
Also used : PrintStream(java.io.PrintStream) File(java.io.File) ManagedOperation(org.infinispan.jmx.annotations.ManagedOperation)

Example 4 with ManagedOperation

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

the class EmbeddedClusteredLockManager method removeSync.

@ManagedOperation(description = "Removes the lock from the cluster. The lock has to be recreated to access next time.", displayName = "Remove Clustered Lock", name = REMOVE)
public boolean removeSync(String name) {
    if (log.isTraceEnabled())
        log.tracef("LOCK[%s] remove sync has been called", name);
    ClusteredLockImpl clusteredLock = (ClusteredLockImpl) locks.get(name);
    if (clusteredLock != null) {
        clusteredLock.stop();
        locks.remove(name);
    }
    return cache().remove(new ClusteredLockKey(ByteString.fromString(name))) != null;
}
Also used : ClusteredLockImpl(org.infinispan.lock.impl.lock.ClusteredLockImpl) ClusteredLockKey(org.infinispan.lock.impl.entries.ClusteredLockKey) ManagedOperation(org.infinispan.jmx.annotations.ManagedOperation)

Example 5 with ManagedOperation

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

the class XSiteAdminOperations method bringSiteOnline.

@ManagedOperation(description = "Brings the given site back online on all the cluster.", displayName = "Brings the given site back online on all the cluster.")
public String bringSiteOnline(@Parameter(name = "site", description = "The name of the backup site") String site) {
    authorizer.checkPermission(AuthorizationPermission.ADMIN);
    BringSiteOnlineResponse rsp = takeOfflineManager.bringSiteOnline(site);
    if (rsp == BringSiteOnlineResponse.NO_SUCH_SITE) {
        return incorrectSiteName(site);
    }
    CacheRpcCommand command = commandsFactory.buildXSiteBringOnlineCommand(site);
    XSiteResponse<Void> response = invokeOnAll(command, new VoidResponseCollector(clusterSize()));
    return returnFailureOrSuccess(response.getErrors(), "Could not take the site online on nodes:");
}
Also used : BringSiteOnlineResponse(org.infinispan.xsite.status.BringSiteOnlineResponse) CacheRpcCommand(org.infinispan.commands.remote.CacheRpcCommand) ManagedOperation(org.infinispan.jmx.annotations.ManagedOperation)

Aggregations

ManagedOperation (org.infinispan.jmx.annotations.ManagedOperation)8 CacheRpcCommand (org.infinispan.commands.remote.CacheRpcCommand)2 ServerBootstrap (io.netty.bootstrap.ServerBootstrap)1 Channel (io.netty.channel.Channel)1 EventLoopGroup (io.netty.channel.EventLoopGroup)1 MultithreadEventLoopGroup (io.netty.channel.MultithreadEventLoopGroup)1 ServerChannel (io.netty.channel.ServerChannel)1 EpollEventLoopGroup (io.netty.channel.epoll.EpollEventLoopGroup)1 EpollServerSocketChannel (io.netty.channel.epoll.EpollServerSocketChannel)1 NioEventLoopGroup (io.netty.channel.nio.NioEventLoopGroup)1 NioServerSocketChannel (io.netty.channel.socket.nio.NioServerSocketChannel)1 File (java.io.File)1 PrintStream (java.io.PrintStream)1 CacheException (org.infinispan.commons.CacheException)1 DistributionInfo (org.infinispan.distribution.DistributionInfo)1 MBean (org.infinispan.jmx.annotations.MBean)1 ClusteredLockKey (org.infinispan.lock.impl.entries.ClusteredLockKey)1 ClusteredLockImpl (org.infinispan.lock.impl.lock.ClusteredLockImpl)1 ClusterExecutor (org.infinispan.manager.ClusterExecutor)1 GlobalSecurityManager (org.infinispan.security.GlobalSecurityManager)1