THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
Code Block |
---|
FunctionService functionService = cache.getFunctionService();
//RegionFunction with a single result
ResultCollector<String, Collection<String>> rc = functionService.onRegion(region)
.execute(ctx -> ctx.getLocalData().get("key"))
Collection<String> values = rc.getResult()
//RegionFunction without a result, that is optimized for write, but is not HA
functionService.onRegion(region)
.optimizeForWrite(true)
.isHA(true)
.hasResult(false)
.execute(ctx -> ctx.getLocalData().put("key", "value))
//On member function that gets the cache from the context
functionService.onMembers()
.hasResult(false)
.execute(ctx -> ctx.getCache().close());
//Function that streams results back using the result sender
functionService.onRegion(region).execute( ctx ->
{
ResultSender<String> s = ctx.getResultSender();
for(String value : ctx.getRegion().values()) {
s.addResult(value)
}
return null;
} |