org.infinispan.commands.remote.GetKeysInGroupCommand Maven / Gradle / Ivy
package org.infinispan.commands.remote;
import org.infinispan.commands.AbstractFlagAffectedCommand;
import org.infinispan.commands.VisitableCommand;
import org.infinispan.commands.Visitor;
import org.infinispan.container.entries.CacheEntry;
import org.infinispan.context.Flag;
import org.infinispan.context.InvocationContext;
import org.infinispan.distribution.group.GroupFilter;
import org.infinispan.distribution.group.GroupManager;
import org.infinispan.lifecycle.ComponentStatus;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* {@link org.infinispan.commands.VisitableCommand} that fetches the keys belonging to a group.
*
* @author Pedro Ruivo
* @since 7.0
*/
public class GetKeysInGroupCommand extends AbstractFlagAffectedCommand implements VisitableCommand {
public static final byte COMMAND_ID = 43;
private String groupName;
/*
local state to avoid checking everywhere if the node in which this command is executed is the group owner.
*/
private transient boolean isGroupOwner;
private transient GroupManager groupManager;
public GetKeysInGroupCommand(Set flags, String groupName) {
this.groupName = groupName;
setFlags(flags);
}
public GetKeysInGroupCommand() {
}
public GetKeysInGroupCommand setGroupManager(GroupManager groupManager) {
this.groupManager = groupManager;
return this;
}
@Override
public Object perform(InvocationContext ctx) throws Throwable {
final KeyValueCollector collector = ctx.isOriginLocal() ?
new LocalContextKeyValueCollector() :
new RemoteContextKeyValueCollector();
final GroupFilter
© 2015 - 2025 Weber Informatics LLC | Privacy Policy