use of org.apache.geode.internal.cache.CacheConfig in project geode by apache.
the class RecreateCacheFunction method execute.
@Override
public void execute(FunctionContext context) {
CliFunctionResult result = null;
InternalCache cache = GemFireCacheImpl.getInstance();
DistributedSystem ds = cache.getDistributedSystem();
CacheConfig cacheConfig = cache.getCacheConfig();
try {
cache.close("Re-create Cache", true, true);
GemFireCacheImpl.create(ds, cacheConfig);
} catch (RuntimeException e) {
result = new CliFunctionResult(ds.getName(), e, e.getMessage());
context.getResultSender().lastResult(result);
return;
}
result = new CliFunctionResult(ds.getName(), true, "Cache successfully re-created.");
context.getResultSender().lastResult(result);
}
use of org.apache.geode.internal.cache.CacheConfig in project geode by apache.
the class DefaultServerLauncherCacheProvider method createCache.
@Override
public Cache createCache(Properties gemfireProperties, ServerLauncher serverLauncher) {
final CacheConfig cacheConfig = serverLauncher.getCacheConfig();
final CacheFactory cacheFactory = new CacheFactory(gemfireProperties);
if (cacheConfig.pdxPersistentUserSet) {
cacheFactory.setPdxPersistent(cacheConfig.isPdxPersistent());
}
if (cacheConfig.pdxDiskStoreUserSet) {
cacheFactory.setPdxDiskStore(cacheConfig.getPdxDiskStore());
}
if (cacheConfig.pdxIgnoreUnreadFieldsUserSet) {
cacheFactory.setPdxIgnoreUnreadFields(cacheConfig.getPdxIgnoreUnreadFields());
}
if (cacheConfig.pdxReadSerializedUserSet) {
cacheFactory.setPdxReadSerialized(cacheConfig.isPdxReadSerialized());
}
if (cacheConfig.pdxSerializerUserSet) {
cacheFactory.setPdxSerializer(cacheConfig.getPdxSerializer());
}
return cacheFactory.create();
}
use of org.apache.geode.internal.cache.CacheConfig in project geode by apache.
the class WANTestBase method createReceiver_PDX.
public static int createReceiver_PDX(int locPort) {
WANTestBase test = new WANTestBase();
Properties props = test.getDistributedSystemProperties();
props.setProperty(MCAST_PORT, "0");
props.setProperty(LOCATORS, "localhost[" + locPort + "]");
InternalDistributedSystem ds = test.getSystem(props);
CacheConfig cacheConfig = new CacheConfig();
File pdxDir = new File(CacheTestCase.getDiskDir(), "pdx");
cacheConfig.setPdxPersistent(true);
cacheConfig.setPdxDiskStore("pdxStore");
cache = GemFireCacheImpl.create(ds, false, cacheConfig);
cache.createDiskStoreFactory().setDiskDirs(new File[] { pdxDir }).setMaxOplogSize(1).create("pdxStore");
GatewayReceiverFactory fact = cache.createGatewayReceiverFactory();
int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
fact.setStartPort(port);
fact.setEndPort(port);
fact.setManualStart(true);
GatewayReceiver receiver = fact.create();
try {
receiver.start();
} catch (IOException e) {
e.printStackTrace();
fail("Test " + test.getName() + " failed to start GatewayReceiver on port " + port);
}
return port;
}
Aggregations