org.infinispan.commands.remote.GetKeysInGroupCommand Maven / Gradle / Ivy
package org.infinispan.commands.remote;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import org.infinispan.commands.AbstractTopologyAffectedCommand;
import org.infinispan.commands.VisitableCommand;
import org.infinispan.commands.Visitor;
import org.infinispan.container.entries.CacheEntry;
import org.infinispan.context.InvocationContext;
import org.infinispan.context.impl.FlagBitSets;
import org.infinispan.distribution.group.impl.GroupFilter;
import org.infinispan.distribution.group.impl.GroupManager;
/**
* {@link org.infinispan.commands.VisitableCommand} that fetches the keys belonging to a group.
*
* @author Pedro Ruivo
* @since 7.0
*/
public class GetKeysInGroupCommand extends AbstractTopologyAffectedCommand implements VisitableCommand {
public static final byte COMMAND_ID = 43;
private Object 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(long flagsBitSet, Object groupName) {
this.groupName = groupName;
setFlagsBitSet(flagsBitSet);
}
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