use of org.apache.geode.cache.client.internal.ServerRegionProxy in project geode by apache.
the class EventIdOptimizationDUnitTest method generateEventsByClearRegionOperation.
/**
* Generates events having specific values of threadId and sequenceId, via clearRegionOperation
* through connection object
*
* @throws Exception - thrown if any problem occurs in clearRegionOperation
*/
public static void generateEventsByClearRegionOperation() throws Exception {
Connection connection = pool.acquireConnection();
String regionName = Region.SEPARATOR + REGION_NAME;
ServerRegionProxy srp = new ServerRegionProxy(regionName, pool);
for (int i = 0; i < eventIds.length; i++) {
srp.clearOnForTestsOnly(connection, eventIds[i], null);
}
srp.clearOnForTestsOnly(connection, eventIdForLastKey, null);
}
use of org.apache.geode.cache.client.internal.ServerRegionProxy in project geode by apache.
the class EventIdOptimizationDUnitTest method generateEventsByDestroyRegionOperation.
/**
* Generates events having specific values of threadId and sequenceId, via destroyRegionOperation
* through connection object
*
* @throws Exception - thrown if any problem occurs in destroyRegionOperation
*/
public static void generateEventsByDestroyRegionOperation() throws Exception {
Connection connection = pool.acquireConnection();
String regionName = Region.SEPARATOR + REGION_NAME;
for (int i = 0; i < 1; i++) {
ServerRegionProxy srp = new ServerRegionProxy(regionName + i, pool);
srp.destroyRegionOnForTestsOnly(connection, eventIds[i], null);
}
{
ServerRegionProxy srp = new ServerRegionProxy(regionName, pool);
srp.destroyRegionOnForTestsOnly(connection, eventIdForLastKey, null);
}
}
use of org.apache.geode.cache.client.internal.ServerRegionProxy in project geode by apache.
the class HAInterestTestCase method stopPrimaryAndRegisterK1AndK2AndVerifyResponse.
public static void stopPrimaryAndRegisterK1AndK2AndVerifyResponse() {
LocalRegion r = (LocalRegion) cache.getRegion(Region.SEPARATOR + REGION_NAME);
assertNotNull(r);
ServerRegionProxy srp = new ServerRegionProxy(r);
WaitCriterion wc = new WaitCriterion() {
@Override
public boolean done() {
return pool.getConnectedServerCount() == 3;
}
@Override
public String description() {
return "connected server count never became 3";
}
};
Wait.waitForCriterion(wc, TIMEOUT_MILLIS, INTERVAL_MILLIS, true);
// close primaryEP
getPrimaryVM().invoke(() -> HAInterestTestCase.stopServer());
List list = new ArrayList();
list.add(k1);
list.add(k2);
List serverKeys = srp.registerInterest(list, InterestType.KEY, InterestResultPolicy.KEYS, false, r.getAttributes().getDataPolicy().ordinal);
assertNotNull(serverKeys);
List resultKeys = (List) serverKeys.get(0);
assertEquals(2, resultKeys.size());
assertTrue(resultKeys.contains(k1));
assertTrue(resultKeys.contains(k2));
}
use of org.apache.geode.cache.client.internal.ServerRegionProxy in project geode by apache.
the class HAInterestTestCase method stopBothPrimaryAndSecondaryAndRegisterK1AndK2AndVerifyResponse.
public static void stopBothPrimaryAndSecondaryAndRegisterK1AndK2AndVerifyResponse() {
LocalRegion r = (LocalRegion) cache.getRegion(Region.SEPARATOR + REGION_NAME);
assertNotNull(r);
ServerRegionProxy srp = new ServerRegionProxy(r);
WaitCriterion wc = new WaitCriterion() {
@Override
public boolean done() {
return pool.getConnectedServerCount() == 3;
}
@Override
public String description() {
return "connected server count never became 3";
}
};
Wait.waitForCriterion(wc, TIMEOUT_MILLIS, INTERVAL_MILLIS, true);
// close primaryEP
VM backup = getBackupVM();
getPrimaryVM().invoke(() -> HAInterestTestCase.stopServer());
// close secondary
backup.invoke(() -> HAInterestTestCase.stopServer());
List list = new ArrayList();
list.add(k1);
list.add(k2);
List serverKeys = srp.registerInterest(list, InterestType.KEY, InterestResultPolicy.KEYS, false, r.getAttributes().getDataPolicy().ordinal);
assertNotNull(serverKeys);
List resultKeys = (List) serverKeys.get(0);
assertEquals(2, resultKeys.size());
assertTrue(resultKeys.contains(k1));
assertTrue(resultKeys.contains(k2));
}
use of org.apache.geode.cache.client.internal.ServerRegionProxy in project geode by apache.
the class ServerRegionFunctionExecutor method executeOnServer.
private ResultCollector executeOnServer(String functionId, ResultCollector collector, byte hasResult, boolean isHA, boolean optimizeForWrite) throws FunctionException {
ServerRegionProxy srp = getServerRegionProxy();
FunctionStats stats = FunctionStats.getFunctionStats(functionId, this.region.getSystem());
try {
validateExecution(null, null);
long start = stats.startTime();
stats.startFunctionExecution(true);
srp.executeFunction(this.region.getFullPath(), functionId, this, collector, hasResult, isHA, optimizeForWrite, false);
stats.endFunctionExecution(start, true);
return collector;
} catch (FunctionException functionException) {
stats.endFunctionExecutionWithException(true);
throw functionException;
} catch (Exception exception) {
stats.endFunctionExecutionWithException(true);
throw new FunctionException(exception);
}
}
Aggregations