use of org.apache.geode.cache.client.internal.ServerRegionProxy in project geode by apache.
the class ServerRegionFunctionExecutor method executeOnServer.
private ResultCollector executeOnServer(Function function, ResultCollector collector, byte hasResult) throws FunctionException {
ServerRegionProxy srp = getServerRegionProxy();
FunctionStats stats = FunctionStats.getFunctionStats(function.getId(), this.region.getSystem());
try {
validateExecution(function, null);
long start = stats.startTime();
stats.startFunctionExecution(true);
srp.executeFunction(this.region.getFullPath(), function, this, collector, hasResult, 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);
}
}
use of org.apache.geode.cache.client.internal.ServerRegionProxy in project geode by apache.
the class ServerRegionFunctionExecutor method getServerRegionProxy.
private ServerRegionProxy getServerRegionProxy() throws FunctionException {
ServerRegionProxy srp = region.getServerProxy();
if (srp != null) {
if (logger.isDebugEnabled()) {
logger.debug("Found server region proxy on region. RegionName: {}", region.getName());
}
return srp;
} else {
StringBuilder message = new StringBuilder();
message.append(srp).append(": ");
message.append("No available connection was found. Server Region Proxy is not available for this region ").append(region.getName());
throw new FunctionException(message.toString());
}
}
use of org.apache.geode.cache.client.internal.ServerRegionProxy in project geode by apache.
the class LocalRegion method serverRegionClear.
/**
* @since GemFire 5.7
*/
private void serverRegionClear(RegionEventImpl regionEvent) {
if (regionEvent.getOperation().isDistributed()) {
ServerRegionProxy mySRP = getServerProxy();
if (mySRP != null) {
EventID eventId = regionEvent.getEventId();
Object callbackArg = regionEvent.getRawCallbackArgument();
mySRP.clear(eventId, callbackArg);
}
}
}
use of org.apache.geode.cache.client.internal.ServerRegionProxy in project geode by apache.
the class LocalRegion method serverRegionDestroy.
/**
* @since GemFire 5.7
*/
void serverRegionDestroy(RegionEventImpl regionEvent) {
if (regionEvent.getOperation().isDistributed()) {
ServerRegionProxy mySRP = getServerProxy();
if (mySRP != null) {
EventID eventId = regionEvent.getEventId();
Object callbackArg = regionEvent.getRawCallbackArgument();
mySRP.destroyRegion(eventId, callbackArg);
}
}
}
use of org.apache.geode.cache.client.internal.ServerRegionProxy in project geode by apache.
the class EventIdOptimizationDUnitTest method generateEventsByPutOperation.
/**
* Generates events having specific values of threadId and sequenceId, via put operation through
* connection object
*
* @throws Exception - thrown if any problem occurs in put operation
*/
public static void generateEventsByPutOperation() 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.putOnForTestsOnly(connection, "KEY-" + i, "VAL-" + i, eventIds[i], null);
}
srp.putOnForTestsOnly(connection, LAST_KEY, "LAST_VAL", eventIdForLastKey, null);
}
Aggregations