use of org.apache.geode.test.dunit.SerializableRunnable in project geode by apache.
the class CqQueryDUnitTest method performGC.
private void performGC(VM server, final String regionName) {
SerializableRunnable task = new CacheSerializableRunnable("perform GC") {
public void run2() throws CacheException {
Region subregion = getCache().getRegion("root/" + regionName);
DistributedTombstoneOperation gc = DistributedTombstoneOperation.gc((DistributedRegion) subregion, new EventID(getCache().getDistributedSystem()));
gc.distribute();
}
};
server.invoke(task);
}
use of org.apache.geode.test.dunit.SerializableRunnable in project geode by apache.
the class CqQueryDUnitTest method createPartitionRegion.
public void createPartitionRegion(final VM server, final String[] regionNames) {
SerializableRunnable createRegion = new CacheSerializableRunnable("Create Region") {
public void run2() throws CacheException {
RegionFactory rf = getCache().createRegionFactory(RegionShortcut.PARTITION);
for (int i = 0; i < regionNames.length; i++) {
rf.create(regionNames[i]);
}
}
};
server.invoke(createRegion);
}
use of org.apache.geode.test.dunit.SerializableRunnable in project geode by apache.
the class CqQueryDUnitTest method createClient.
/* Create Client */
public void createClient(VM client, final int[] serverPorts, final String serverHost, final String redundancyLevel) {
SerializableRunnable createQService = new CacheSerializableRunnable("Create Client") {
public void run2() throws CacheException {
LogWriterUtils.getLogWriter().info("### Create Client. ###");
// Initialize CQ Service.
try {
getCache().getQueryService();
} catch (Exception cqe) {
cqe.printStackTrace();
fail("Failed to getCQService.");
}
AttributesFactory regionFactory = new AttributesFactory();
regionFactory.setScope(Scope.LOCAL);
if (redundancyLevel != null) {
ClientServerTestCase.configureConnectionPool(regionFactory, serverHost, serverPorts, true, Integer.parseInt(redundancyLevel), -1, null);
} else {
ClientServerTestCase.configureConnectionPool(regionFactory, serverHost, serverPorts, true, -1, -1, null);
}
for (int i = 0; i < regions.length; i++) {
createRegion(regions[i], regionFactory.createRegionAttributes());
LogWriterUtils.getLogWriter().info("### Successfully Created Region on Client :" + regions[i]);
// region1.getAttributesMutator().setCacheListener(new CqListener());
}
}
};
client.invoke(createQService);
}
use of org.apache.geode.test.dunit.SerializableRunnable in project geode by apache.
the class CqQueryDUnitTest method crashServer.
public void crashServer(VM server) {
server.invoke(new SerializableRunnable("Crash CacheServer") {
public void run() {
org.apache.geode.cache.client.internal.ConnectionImpl.setTEST_DURABLE_CLIENT_CRASH(true);
LogWriterUtils.getLogWriter().info("### Crashing CacheServer. ###");
stopBridgeServer(getCache());
}
});
Wait.pause(2 * 1000);
}
use of org.apache.geode.test.dunit.SerializableRunnable in project geode by apache.
the class CqQueryDUnitTest method closeClient.
/* Close Client */
public void closeClient(VM client) {
SerializableRunnable closeCQService = new CacheSerializableRunnable("Close Client") {
public void run2() throws CacheException {
LogWriterUtils.getLogWriter().info("### Close Client. ###");
try {
((DefaultQueryService) getCache().getQueryService()).closeCqService();
} catch (Exception ex) {
LogWriterUtils.getLogWriter().info("### Failed to get CqService during ClientClose() ###");
}
}
};
client.invoke(closeCQService);
Wait.pause(2 * 1000);
}
Aggregations