From 324b25e5cfd451e650dcf34fd1b5fb5e36749334 Mon Sep 17 00:00:00 2001 From: John Blum Date: Mon, 11 Aug 2014 16:21:58 -0700 Subject: [PATCH] Fixes JIRA issue SGF-304 changing the GroupMembersFunctionExecution class to call the correct GemFire com.gemstone.gemfire.cache.execute.FunctionService method, onMembers(groups:String[]) (plural). Performed additional refactoring in related classes. --- .../GemfireOnMemberFunctionTemplate.java | 9 +++--- .../GemfireOnMembersFunctionTemplate.java | 18 ++++++------ .../GroupMemberFunctionExecution.java | 27 ++++++++++++------ .../GroupMembersFunctionExecution.java | 28 +++++++++++++------ 4 files changed, 52 insertions(+), 30 deletions(-) diff --git a/src/main/java/org/springframework/data/gemfire/function/execution/GemfireOnMemberFunctionTemplate.java b/src/main/java/org/springframework/data/gemfire/function/execution/GemfireOnMemberFunctionTemplate.java index dcbe099f..cf81fc78 100644 --- a/src/main/java/org/springframework/data/gemfire/function/execution/GemfireOnMemberFunctionTemplate.java +++ b/src/main/java/org/springframework/data/gemfire/function/execution/GemfireOnMemberFunctionTemplate.java @@ -16,9 +16,9 @@ package org.springframework.data.gemfire.function.execution; import com.gemstone.gemfire.distributed.DistributedMember; /** - * * @author David Turanski - * + * @see org.springframework.data.gemfire.function.execution.AbstractFunctionTemplate + * @see com.gemstone.gemfire.distributed.DistributedMember */ public class GemfireOnMemberFunctionTemplate extends AbstractFunctionTemplate { @@ -46,8 +46,9 @@ public class GemfireOnMemberFunctionTemplate extends AbstractFunctionTemplate { return new DefaultMemberFunctionExecution(); } else if (distributedMember == null) { return new GroupMemberFunctionExecution(this.groups); - - } + } + return new DistributedMemberFunctionExecution(this.distributedMember); } + } diff --git a/src/main/java/org/springframework/data/gemfire/function/execution/GemfireOnMembersFunctionTemplate.java b/src/main/java/org/springframework/data/gemfire/function/execution/GemfireOnMembersFunctionTemplate.java index 43d43d1d..8a407832 100644 --- a/src/main/java/org/springframework/data/gemfire/function/execution/GemfireOnMembersFunctionTemplate.java +++ b/src/main/java/org/springframework/data/gemfire/function/execution/GemfireOnMembersFunctionTemplate.java @@ -18,36 +18,36 @@ import com.gemstone.gemfire.distributed.DistributedMember; /** * @author David Turanski - * + * @see org.springframework.data.gemfire.function.execution.AbstractFunctionTemplate + * @see com.gemstone.gemfire.distributed.DistributedMember */ public class GemfireOnMembersFunctionTemplate extends AbstractFunctionTemplate { - + private final Set distributedMembers; private final String[] groups; - + public GemfireOnMembersFunctionTemplate (Set distributedMembers) { this.distributedMembers = distributedMembers; this.groups = null; } - + public GemfireOnMembersFunctionTemplate (String[] groups) { this.distributedMembers = null; this.groups = groups; } - + public GemfireOnMembersFunctionTemplate () { this.distributedMembers = null; this.groups = null; } - - + protected AbstractFunctionExecution getFunctionExecution() { if (distributedMembers == null && groups == null) { return new AllMembersFunctionExecution(); } else if (distributedMembers == null) { return new GroupMembersFunctionExecution(this.groups); - - } + } + return new DistributedMembersFunctionExecution(this.distributedMembers); } diff --git a/src/main/java/org/springframework/data/gemfire/function/execution/GroupMemberFunctionExecution.java b/src/main/java/org/springframework/data/gemfire/function/execution/GroupMemberFunctionExecution.java index b52034ac..fb1f1ef1 100644 --- a/src/main/java/org/springframework/data/gemfire/function/execution/GroupMemberFunctionExecution.java +++ b/src/main/java/org/springframework/data/gemfire/function/execution/GroupMemberFunctionExecution.java @@ -19,22 +19,33 @@ import com.gemstone.gemfire.cache.execute.FunctionService; /** * @author David Turanski - * + * @author John Blum + * @see org.springframework.data.gemfire.function.execution.AbstractFunctionExecution + * @see com.gemstone.gemfire.cache.execute.Execution + * @see com.gemstone.gemfire.cache.execute.FunctionService */ class GroupMemberFunctionExecution extends AbstractFunctionExecution { - private final String groups[]; + private final String[] groups; /** - * - * @param groups + * Constructs an instance of the GroupMemberFunctionExecution class to execute a data independent Function + * on a single member from each of the specified groups. + * + * @param groups the list of GemFire Groups from which to pick a member from each group on which to execute + * the data independent Function. */ - public GroupMemberFunctionExecution(String... groups) { - super(); - Assert.notEmpty(groups, "groups cannot be null or empty."); + public GroupMemberFunctionExecution(final String... groups) { + Assert.notEmpty(groups, "'groups' cannot be null or empty."); this.groups = groups; } - + + /** + * Executes the data independent Function on a single member from each of the specified groups. + * + * @return an Execution to execute the Function. + * @see com.gemstone.gemfire.cache.execute.FunctionService#onMember(String...) + */ @Override protected Execution getExecution() { return FunctionService.onMember(this.groups); diff --git a/src/main/java/org/springframework/data/gemfire/function/execution/GroupMembersFunctionExecution.java b/src/main/java/org/springframework/data/gemfire/function/execution/GroupMembersFunctionExecution.java index 5de678c8..99d911fe 100644 --- a/src/main/java/org/springframework/data/gemfire/function/execution/GroupMembersFunctionExecution.java +++ b/src/main/java/org/springframework/data/gemfire/function/execution/GroupMembersFunctionExecution.java @@ -19,25 +19,35 @@ import com.gemstone.gemfire.cache.execute.FunctionService; /** * @author David Turanski - * + * @author John Blum + * @see org.springframework.data.gemfire.function.execution.AbstractFunctionExecution + * @see com.gemstone.gemfire.cache.execute.Execution + * @see com.gemstone.gemfire.cache.execute.FunctionService */ class GroupMembersFunctionExecution extends AbstractFunctionExecution { - private final String groups[]; + private final String[] groups; /** - * - * @param groups + * Constructs an instance of the GroupMembersFunctionExecution class to execute a data independent Function + * on all members from each of the specified groups. + * + * @param groups the list of GemFire Groups indicating the members on which to execute the data independent Function. */ - public GroupMembersFunctionExecution(String... groups) { - super(); - Assert.notEmpty(groups, "groups cannot be null or empty."); + public GroupMembersFunctionExecution(final String... groups) { + Assert.notEmpty(groups, "'groups' cannot be null or empty."); this.groups = groups; } - + + /** + * Executes the data independent Function on all members from each of the specified groups. + * + * @return an Execution to execute the Function. + * @see com.gemstone.gemfire.cache.execute.FunctionService#onMembers(String...) + */ @Override protected Execution getExecution() { - return FunctionService.onMember(this.groups); + return FunctionService.onMembers(this.groups); } }