use of com.examples.snapshot.MyPdxSerializer in project geode by apache.
the class ParallelSnapshotDUnitTest method loadCache.
public void loadCache() throws Exception {
SerializableCallable setup = new SerializableCallable() {
@Override
public Object call() throws Exception {
CacheFactory cf = new CacheFactory().setPdxSerializer(new MyPdxSerializer());
Cache cache = getCache(cf);
RegionGenerator rgen = new RegionGenerator();
rgen.createRegion(cache, null, RegionType.PARTITION, "test");
return null;
}
};
forEachVm(setup, true);
}
use of com.examples.snapshot.MyPdxSerializer in project geode by apache.
the class SnapshotByteArrayDUnitTest method loadCache.
public void loadCache() throws Exception {
SerializableCallable setup = new SerializableCallable() {
@Override
public Object call() throws Exception {
CacheFactory cf = new CacheFactory().setPdxSerializer(new MyPdxSerializer()).setPdxPersistent(true);
Cache cache = getCache(cf);
RegionGenerator rgen = new RegionGenerator();
rgen.createRegion(cache, null, RegionType.REPLICATE, "snapshot-ops");
return null;
}
};
SnapshotDUnitTest.forEachVm(setup, true);
}
use of com.examples.snapshot.MyPdxSerializer in project geode by apache.
the class SnapshotPerformanceDUnitTest method createCache.
private void createCache() throws Exception {
SerializableCallable setup = new SerializableCallable() {
@Override
public Object call() throws Exception {
CacheFactory cf = new CacheFactory().setPdxSerializer(new MyPdxSerializer());
getCache(cf);
return null;
}
};
SnapshotDUnitTest.forEachVm(setup, true);
}
use of com.examples.snapshot.MyPdxSerializer in project geode by apache.
the class PdxTypeExportDUnitTest method loadCache.
@SuppressWarnings("serial")
public void loadCache() throws Exception {
SerializableCallable peer = new SerializableCallable() {
@Override
public Object call() throws Exception {
CacheFactory cf = new CacheFactory().setPdxSerializer(new MyPdxSerializer());
Cache cache = getCache(cf);
Region r = cache.createRegionFactory(RegionShortcut.REPLICATE).create("pdxtest");
r.put(1, new MyObjectPdx(1, "test", MyEnumPdx.const1));
return null;
}
};
final Host host = Host.getHost(0);
host.getVM(1).invoke(peer);
SerializableCallable server = new SerializableCallable() {
@Override
public Object call() throws Exception {
CacheFactory cf = new CacheFactory().setPdxSerializer(new MyPdxSerializer());
CacheServer server = getCache().addCacheServer();
int port = AvailablePortHelper.getRandomAvailableTCPPort();
server.setPort(port);
server.start();
Region r = getCache().createRegionFactory(RegionShortcut.REPLICATE).create("pdxtest");
return port;
}
};
final int port = (Integer) host.getVM(2).invoke(server);
SerializableCallable client = new SerializableCallable() {
@Override
public Object call() throws Exception {
ClientCacheFactory cf = new ClientCacheFactory().setPdxSerializer(new MyPdxSerializer()).addPoolServer(NetworkUtils.getServerHostName(host), port);
ClientCache cache = getClientCache(cf);
Region r = cache.createClientRegionFactory(ClientRegionShortcut.PROXY).create("pdxtest");
return null;
}
};
host.getVM(3).invoke(client);
peer.call();
}
use of com.examples.snapshot.MyPdxSerializer in project geode by apache.
the class ClientSnapshotDUnitTest method loadCache.
@SuppressWarnings("serial")
public void loadCache() throws Exception {
CacheFactory cf = new CacheFactory().setPdxSerializer(new MyPdxSerializer());
Cache cache = getCache(cf);
CacheServer server = cache.addCacheServer();
final int port = AvailablePortHelper.getRandomAvailableTCPPort();
server.setPort(port);
server.start();
region = cache.<Integer, MyObject>createRegionFactory(RegionShortcut.REPLICATE).create("clienttest");
final Host host = Host.getHost(0);
SerializableCallable client = new SerializableCallable() {
@Override
public Object call() throws Exception {
ClientCacheFactory cf = new ClientCacheFactory().set(LOG_LEVEL, LogWriterUtils.getDUnitLogLevel()).setPdxSerializer(new MyPdxSerializer()).addPoolServer(NetworkUtils.getServerHostName(host), port).setPoolSubscriptionEnabled(true).setPoolPRSingleHopEnabled(false);
ClientCache cache = getClientCache(cf);
Region r = cache.createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY_HEAP_LRU).setEvictionAttributes(EvictionAttributes.createLRUEntryAttributes(5)).create("clienttest");
return null;
}
};
SerializableCallable remote = new SerializableCallable() {
@Override
public Object call() throws Exception {
CacheFactory cf = new CacheFactory().setPdxSerializer(new MyPdxSerializer());
Cache cache = getCache(cf);
cache.<Integer, MyObject>createRegionFactory(RegionShortcut.REPLICATE).create("clienttest");
return null;
}
};
host.getVM(3).invoke(client);
host.getVM(2).invoke(remote);
}
Aggregations