Search in sources :

Example 1 with DistribuedRegionFunctionFunctionInvocationException

use of org.apache.geode.internal.cache.functions.DistribuedRegionFunctionFunctionInvocationException in project geode by apache.

the class MyFunctionException method registerFunction.

public static void registerFunction(Boolean isHA, Integer retryCount) {
    Function function = new DistribuedRegionFunctionFunctionInvocationException(isHA.booleanValue(), retryCount.intValue());
    FunctionService.registerFunction(function);
}
Also used : Function(org.apache.geode.cache.execute.Function) TestFunction(org.apache.geode.internal.cache.functions.TestFunction) DistributedRegionFunction(org.apache.geode.internal.cache.functions.DistributedRegionFunction) DistribuedRegionFunctionFunctionInvocationException(org.apache.geode.internal.cache.functions.DistribuedRegionFunctionFunctionInvocationException)

Example 2 with DistribuedRegionFunctionFunctionInvocationException

use of org.apache.geode.internal.cache.functions.DistribuedRegionFunctionFunctionInvocationException in project geode by apache.

the class MyFunctionException method executeFunctionFunctionInvocationTargetExceptionWithoutHA.

public static void executeFunctionFunctionInvocationTargetExceptionWithoutHA() {
    try {
        ResultCollector rc1 = FunctionService.onRegion(region).setArguments(Boolean.TRUE).execute("DistribuedRegionFunctionFunctionInvocationException", true, false);
        rc1.getResult();
        fail("Function Invocation Target Exception should be thrown");
    } catch (Exception e) {
        e.printStackTrace();
        if (!(e.getCause() instanceof FunctionInvocationTargetException)) {
            fail("FunctionInvocationTargetException should be thrown");
        }
    }
}
Also used : FunctionInvocationTargetException(org.apache.geode.cache.execute.FunctionInvocationTargetException) ResultCollector(org.apache.geode.cache.execute.ResultCollector) IgnoredException(org.apache.geode.test.dunit.IgnoredException) FunctionInvocationTargetException(org.apache.geode.cache.execute.FunctionInvocationTargetException) IOException(java.io.IOException) DistribuedRegionFunctionFunctionInvocationException(org.apache.geode.internal.cache.functions.DistribuedRegionFunctionFunctionInvocationException)

Example 3 with DistribuedRegionFunctionFunctionInvocationException

use of org.apache.geode.internal.cache.functions.DistribuedRegionFunctionFunctionInvocationException in project geode by apache.

the class MyFunctionException method executeFunctionFunctionInvocationTargetException.

public static void executeFunctionFunctionInvocationTargetException() {
    try {
        ResultCollector rc1 = FunctionService.onRegion(region).setArguments(Boolean.TRUE).execute("DistribuedRegionFunctionFunctionInvocationException");
        List list = (ArrayList) rc1.getResult();
        assertEquals(5, list.get(0));
    } catch (Exception e) {
        e.printStackTrace();
        Assert.fail("This is not expected Exception", e);
    }
}
Also used : ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) ResultCollector(org.apache.geode.cache.execute.ResultCollector) IgnoredException(org.apache.geode.test.dunit.IgnoredException) FunctionInvocationTargetException(org.apache.geode.cache.execute.FunctionInvocationTargetException) IOException(java.io.IOException) DistribuedRegionFunctionFunctionInvocationException(org.apache.geode.internal.cache.functions.DistribuedRegionFunctionFunctionInvocationException)

Example 4 with DistribuedRegionFunctionFunctionInvocationException

use of org.apache.geode.internal.cache.functions.DistribuedRegionFunctionFunctionInvocationException in project geode by apache.

the class MyFunctionException method executeFunctionFunctionInvocationTargetException_ClientServer.

public static void executeFunctionFunctionInvocationTargetException_ClientServer() {
    try {
        List list = (ArrayList) FunctionService.onRegion(region).setArguments(Boolean.TRUE).execute("DistribuedRegionFunctionFunctionInvocationException").getResult();
        assertEquals(1, list.size());
        assertEquals(5, list.get(0));
    } catch (Exception e) {
        e.printStackTrace();
        Assert.fail("This is not expected Exception", e);
    }
}
Also used : ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) IgnoredException(org.apache.geode.test.dunit.IgnoredException) FunctionInvocationTargetException(org.apache.geode.cache.execute.FunctionInvocationTargetException) IOException(java.io.IOException) DistribuedRegionFunctionFunctionInvocationException(org.apache.geode.internal.cache.functions.DistribuedRegionFunctionFunctionInvocationException)

Aggregations

DistribuedRegionFunctionFunctionInvocationException (org.apache.geode.internal.cache.functions.DistribuedRegionFunctionFunctionInvocationException)4 IOException (java.io.IOException)3 FunctionInvocationTargetException (org.apache.geode.cache.execute.FunctionInvocationTargetException)3 IgnoredException (org.apache.geode.test.dunit.IgnoredException)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 ResultCollector (org.apache.geode.cache.execute.ResultCollector)2 Function (org.apache.geode.cache.execute.Function)1 DistributedRegionFunction (org.apache.geode.internal.cache.functions.DistributedRegionFunction)1 TestFunction (org.apache.geode.internal.cache.functions.TestFunction)1