org.infinispan.commands.CreateCacheCommand Maven / Gradle / Ivy
package org.infinispan.commands;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import org.infinispan.Cache;
import org.infinispan.commands.remote.BaseRpcCommand;
import org.infinispan.configuration.cache.Configuration;
import org.infinispan.distribution.DistributionManager;
import org.infinispan.factories.ComponentRegistry;
import org.infinispan.manager.EmbeddedCacheManager;
import org.infinispan.statetransfer.StateTransferLock;
import org.infinispan.topology.CacheTopology;
import org.infinispan.util.ByteString;
import org.infinispan.commons.time.TimeService;
import org.infinispan.util.concurrent.CompletableFutures;
import org.infinispan.util.logging.Log;
import org.infinispan.util.logging.LogFactory;
/**
* Command to create/start a cache on a subset of Infinispan cluster nodes
* @author Vladimir Blagojevic
* @since 5.2
*/
public class CreateCacheCommand extends BaseRpcCommand {
private static final Log log = LogFactory.getLog(CreateCacheCommand.class);
public static final byte COMMAND_ID = 29;
private EmbeddedCacheManager cacheManager;
private String cacheNameToCreate;
private String cacheConfigurationName;
private int expectedMembers;
private CreateCacheCommand() {
super(null);
}
public CreateCacheCommand(ByteString ownerCacheName) {
super(ownerCacheName);
}
public CreateCacheCommand(ByteString ownerCacheName, String cacheNameToCreate, String cacheConfigurationName) {
this(ownerCacheName, cacheNameToCreate, cacheConfigurationName, 0);
}
public CreateCacheCommand(ByteString cacheName, String cacheNameToCreate, String cacheConfigurationName,
int expectedMembers) {
super(cacheName);
this.cacheNameToCreate = cacheNameToCreate;
this.cacheConfigurationName = cacheConfigurationName;
this.expectedMembers = expectedMembers;
}
public void init(EmbeddedCacheManager cacheManager) {
this.cacheManager = cacheManager;
}
@Override
public CompletableFuture
© 2015 - 2025 Weber Informatics LLC | Privacy Policy