Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

RegionFunctionContext should have a method to the local data for the context

Code Block

RegionFunctionContext {
  public Region getLocalData();
}

 

 

 

FunctionContext should have a method to return the cache

Code Block
interface FunctionContext {
  getCache();
}

 

 

isHA, optimizeForWrite, and hasResult should be removed from Function and should be added to Execution instead

...

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());