org.apache.geode.cache.execute.FunctionService Java Examples

The following examples show how to use org.apache.geode.cache.execute.FunctionService. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Example.java    From geode-examples with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) {
  // connect to the locator using default port 10334
  ClientCache cache = new ClientCacheFactory().addPoolLocator("127.0.0.1", 10334)
      .set("log-level", "WARN").create();

  // create a local region that matches the server region
  Region<Integer, String> region =
      cache.<Integer, String>createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY)
          .create("example-region");

  Execution execution = FunctionService.onRegion(region);
  new Example().getPrimes(region, execution);
  cache.close();
}
 
Example #2
Source File: AutoConfiguredFunctionExecutionsIntegrationTests.java    From spring-boot-data-geode with Apache License 2.0 5 votes vote down vote up
@Test
public void firstFunctionsMustBeRegistered() {

	Arrays.stream(CalculatorFunctions.class.getMethods())
		.filter(method -> !Object.class.equals(method.getDeclaringClass()))
		.map(Method::getName)
		.forEach(methodName -> assertThat(FunctionService.isRegistered(methodName))
			.describedAs("Function [%s] was not registered", methodName)
			.isTrue());
}
 
Example #3
Source File: Example.java    From geode-examples with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) {
  // connect to the locator using default port 10334
  ClientCache cache = new ClientCacheFactory().addPoolLocator("127.0.0.1", 10334)
      .set("log-level", "WARN").create();

  // create a local region that matches the server region
  Region<Integer, String> region =
      cache.<Integer, String>createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY)
          .create("example-region");

  Execution execution = FunctionService.onRegion(region);
  new Example().getPrimes(region, execution);
  cache.close();
}
 
Example #4
Source File: GeodeSamplesLiveTest.java    From tutorials with MIT License 5 votes vote down vote up
@Test
public void whenExecuteUppercaseNames_thenCustomerNamesAreUppercased() {
    Execution execution = FunctionService.onRegion(this.customerRegion);
    execution.execute(UpperCaseNames.class.getName());
    Customer customer = this.customerRegion.get(new CustomerKey(1));
    assertEquals("GHEORGE", customer.getFirstName());
}