List of usage examples for org.springframework.data.gemfire.function PojoFunctionWrapper setBatchSize
public void setBatchSize(int batchSize)
From source file:org.springframework.data.gemfire.function.GemfireFunctionUtils.java
/** * Wrap a target object and method in a GemFire Function and register the function to the {@link FunctionService} * * @param target the target object//from w w w. j a v a 2s . c om * @param method the method bound to the function * @param attributes function attributes * @param overwrite if true, will replace the existing function */ public static void registerFunctionForPojoMethod(Object target, Method method, Map<String, Object> attributes, boolean overwrite) { String id = attributes.containsKey("id") ? (String) attributes.get("id") : ""; PojoFunctionWrapper function = new PojoFunctionWrapper(target, method, id); if (attributes.containsKey("HA")) { function.setHA((Boolean) attributes.get("HA")); } if (attributes.containsKey("optimizeForWrite")) { function.setOptimizeForWrite((Boolean) attributes.get("optimizeForWrite")); } if (attributes.containsKey("batchSize")) { int batchSize = (Integer) attributes.get("batchSize"); Assert.isTrue(batchSize >= 0, String.format("batchSize must be a non-negative value %1$s.%2$s", target.getClass().getName(), method.getName())); function.setBatchSize(batchSize); } if (attributes.containsKey("hasResult")) { // only set if true TODO figure out why??? if (Boolean.TRUE.equals(attributes.get("hasResult"))) { function.setHasResult(true); } } if (FunctionService.isRegistered(function.getId())) { if (overwrite) { if (log.isDebugEnabled()) { log.debug("unregistering function definition " + function.getId()); } FunctionService.unregisterFunction(function.getId()); } } if (!FunctionService.isRegistered(function.getId())) { FunctionService.registerFunction(function); if (log.isDebugEnabled()) { log.debug("registered function " + function.getId()); } } else { if (log.isDebugEnabled()) { log.debug("function " + function.getId() + "is already registered"); } } }