Search in sources :

Example 16 with ServerRegionProxy

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);
    }
}
Also used : ServerRegionProxy(org.apache.geode.cache.client.internal.ServerRegionProxy) FunctionException(org.apache.geode.cache.execute.FunctionException) FunctionException(org.apache.geode.cache.execute.FunctionException) CacheClosedException(org.apache.geode.cache.CacheClosedException)

Example 17 with ServerRegionProxy

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());
    }
}
Also used : ServerRegionProxy(org.apache.geode.cache.client.internal.ServerRegionProxy) FunctionException(org.apache.geode.cache.execute.FunctionException)

Example 18 with ServerRegionProxy

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);
        }
    }
}
Also used : ServerRegionProxy(org.apache.geode.cache.client.internal.ServerRegionProxy) StoredObject(org.apache.geode.internal.offheap.StoredObject)

Example 19 with ServerRegionProxy

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);
        }
    }
}
Also used : ServerRegionProxy(org.apache.geode.cache.client.internal.ServerRegionProxy) StoredObject(org.apache.geode.internal.offheap.StoredObject)

Example 20 with ServerRegionProxy

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);
}
Also used : ServerRegionProxy(org.apache.geode.cache.client.internal.ServerRegionProxy) Connection(org.apache.geode.cache.client.internal.Connection)

Aggregations

ServerRegionProxy (org.apache.geode.cache.client.internal.ServerRegionProxy)34 Connection (org.apache.geode.cache.client.internal.Connection)10 LocalRegion (org.apache.geode.internal.cache.LocalRegion)8 ArrayList (java.util.ArrayList)7 List (java.util.List)7 EventID (org.apache.geode.internal.cache.EventID)7 FunctionException (org.apache.geode.cache.execute.FunctionException)6 WaitCriterion (org.apache.geode.test.dunit.WaitCriterion)6 PoolImpl (org.apache.geode.cache.client.internal.PoolImpl)5 StoredObject (org.apache.geode.internal.offheap.StoredObject)5 CacheClosedException (org.apache.geode.cache.CacheClosedException)4 Region (org.apache.geode.cache.Region)4 ServerLocation (org.apache.geode.distributed.internal.ServerLocation)4 CacheException (org.apache.geode.cache.CacheException)3 CacheWriterException (org.apache.geode.cache.CacheWriterException)3 Operation (org.apache.geode.cache.Operation)3 VM (org.apache.geode.test.dunit.VM)3 EntryNotFoundException (org.apache.geode.cache.EntryNotFoundException)2 EventIDHolder (org.apache.geode.internal.cache.EventIDHolder)2 ConcurrentCacheModificationException (org.apache.geode.internal.cache.versions.ConcurrentCacheModificationException)2