apache-geode code samples

Issue: BAEL-1466
This commit is contained in:
sandy03934
2018-10-01 12:20:49 +05:30
committed by Josh Cummings
parent b343e82095
commit 037c3f4cc4
5 changed files with 325 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
package com.baeldung.geode.functions;
import com.baeldung.geode.Customer;
import com.baeldung.geode.CustomerKey;
import org.apache.geode.cache.Region;
import org.apache.geode.cache.execute.Function;
import org.apache.geode.cache.execute.FunctionContext;
import org.apache.geode.cache.execute.RegionFunctionContext;
import java.util.Map;
public class UpperCaseNames implements Function<Boolean> {
private static final long serialVersionUID = -8946294032165677602L;
@Override
public void execute(FunctionContext<Boolean> context) {
RegionFunctionContext regionContext = (RegionFunctionContext) context;
Region<CustomerKey, Customer> region = regionContext.getDataSet();
for (Map.Entry<CustomerKey, Customer> entry : region.entrySet()) {
Customer customer = entry.getValue();
customer.setFirstName(customer.getFirstName()
.toUpperCase());
}
context.getResultSender()
.lastResult(true);
}
@Override
public String getId() {
return getClass().getName();
}
}