org.infinispan.commands.read.GetAllCommand Maven / Gradle / Ivy
package org.infinispan.commands.read;
import static org.infinispan.commons.util.Util.toStr;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
import org.infinispan.commands.AbstractTopologyAffectedCommand;
import org.infinispan.commands.Visitor;
import org.infinispan.commons.marshall.MarshallUtil;
import org.infinispan.container.InternalEntryFactory;
import org.infinispan.container.entries.CacheEntry;
import org.infinispan.context.InvocationContext;
import org.infinispan.context.impl.FlagBitSets;
import org.infinispan.lifecycle.ComponentStatus;
import org.infinispan.util.logging.Log;
import org.infinispan.util.logging.LogFactory;
/**
* Retrieves multiple entries at once.
*
* @author Radim Vansa <[email protected]>
*/
// TODO: revise the command hierarchy, e.g. this should not implement MetadataAwareCommand
public class GetAllCommand extends AbstractTopologyAffectedCommand {
public static final byte COMMAND_ID = 44;
private static final Log log = LogFactory.getLog(GetAllCommand.class);
private static final boolean trace = log.isTraceEnabled();
private Collection> keys;
private boolean returnEntries;
private /* transient */ InternalEntryFactory entryFactory;
public GetAllCommand(Collection> keys, long flagsBitSet,
boolean returnEntries, InternalEntryFactory entryFactory) {
this.keys = keys;
this.returnEntries = returnEntries;
this.entryFactory = entryFactory;
setFlagsBitSet(flagsBitSet);
}
GetAllCommand() {
}
@Override
public Object acceptVisitor(InvocationContext ctx, Visitor visitor) throws Throwable {
return visitor.visitGetAllCommand(ctx, this);
}
@Override
public boolean shouldInvoke(InvocationContext ctx) {
return true;
}
@Override
public boolean ignoreCommandOnStatus(ComponentStatus status) {
// TODO: this should only be ignored when it is ran in a remote context
return status != ComponentStatus.RUNNING && status != ComponentStatus.INITIALIZING;
}
@Override
public LoadType loadType() {
return LoadType.PRIMARY;
}
@Override
public Object perform(InvocationContext ctx) throws Throwable {
Map
© 2015 - 2025 Weber Informatics LLC | Privacy Policy