geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kl...@apache.org
Subject [14/22] geode git commit: GEODE-1577: Unhelpful generic types on Execution.execute
Date Thu, 13 Apr 2017 17:18:35 GMT
 GEODE-1577: Unhelpful generic types on Execution.execute

  * Replaced wildcards with <T, S> for non-deprecated Execution.execute methods.
  * descriptions added for params <T, S> in javadoc
  * explicit type casting removed
  * This closes #321


Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/4816d394
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/4816d394
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/4816d394

Branch: refs/heads/feature/GEODE-2632
Commit: 4816d39402bf1b2d0ed7ea347695b2aef46a45cb
Parents: 3a64b57
Author: Alyssa Kim <micro9110@gmail.com>
Authored: Mon Dec 12 18:49:25 2016 -0800
Committer: Jason Huynh <huynhja@gmail.com>
Committed: Wed Apr 12 11:06:57 2017 -0700

----------------------------------------------------------------------
 .../apache/geode/cache/execute/Execution.java   | 22 +++++++++++---------
 .../deadlock/GemFireDeadlockDetector.java       |  3 +--
 .../cache/execute/PRClientServerTestBase.java   |  8 +++----
 .../execute/PRFunctionExecutionDUnitTest.java   | 12 ++++-------
 .../cache/lucene/internal/LuceneQueryImpl.java  |  2 +-
 5 files changed, 22 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/4816d394/geode-core/src/main/java/org/apache/geode/cache/execute/Execution.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/execute/Execution.java b/geode-core/src/main/java/org/apache/geode/cache/execute/Execution.java
index 4be2651..c3fdb6e 100755
--- a/geode-core/src/main/java/org/apache/geode/cache/execute/Execution.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/execute/Execution.java
@@ -25,14 +25,17 @@ import org.apache.geode.cache.LowMemoryException;
  * <p>
  * This interface is implemented by GemFire. To obtain an instance of it use
  * {@link FunctionService}.
- * 
- * 
+ *
+ * @param <IN> The type of the argument passed into the function, if any
+ * @param <OUT> The type of results sent by the function
+ * @param <AGG> The type of the aggregated result returned by the ResultCollector
+ *
  * @since GemFire 6.0
  * 
  * @see FunctionService
  * @see Function
  */
-public interface Execution {
+public interface Execution<IN, OUT, AGG> {
 
   /**
    * Specifies a data filter of routing objects for selecting the GemFire members to execute
the
@@ -48,7 +51,7 @@ public interface Execution {
    *         {@link FunctionService#onRegion(org.apache.geode.cache.Region)}
    * @since GemFire 6.0
    */
-  public Execution withFilter(Set<?> filter);
+  public Execution<IN, OUT, AGG> withFilter(Set<?> filter);
 
   /**
    * Specifies the user data passed to the function when it is executed. The function can
retrieve
@@ -60,7 +63,7 @@ public interface Execution {
    * @since GemFire 6.0
    * 
    */
-  public Execution withArgs(Object args);
+  public Execution<IN, OUT, AGG> withArgs(IN args);
 
   /**
    * Specifies the {@link ResultCollector} that will receive the results after the function
has been
@@ -72,15 +75,14 @@ public interface Execution {
    * @see ResultCollector
    * @since GemFire 6.0
    */
-  public Execution withCollector(ResultCollector<?, ?> rc);
+  public Execution<IN, OUT, AGG> withCollector(ResultCollector<OUT, AGG> rc);
 
   /**
    * Executes the function using its {@linkplain Function#getId() id}
    * <p>
    * {@link Function#execute(FunctionContext)} is called on the instance retrieved using
    * {@link FunctionService#getFunction(String)} on the executing member.
-   * 
-   * @param functionId the {@link Function#getId()} of the function
+   *
    * @throws LowMemoryException if the {@link Function#optimizeForWrite()} returns true and
there is
    *         a low memory condition
    * @return ResultCollector to retrieve the results received. This is different object than
the
@@ -89,7 +91,7 @@ public interface Execution {
    * 
    * @since GemFire 6.0
    */
-  public ResultCollector<?, ?> execute(String functionId) throws FunctionException;
+  public ResultCollector<OUT, AGG> execute(String functionId) throws FunctionException;
 
   /**
    * Executes the function instance provided.
@@ -106,7 +108,7 @@ public interface Execution {
    * 
    * @since GemFire 6.0
    */
-  public ResultCollector<?, ?> execute(Function function) throws FunctionException;
+  public ResultCollector<OUT, AGG> execute(Function function) throws FunctionException;
 
   /**
    * Executes the function using its {@linkplain Function#getId() id}

http://git-wip-us.apache.org/repos/asf/geode/blob/4816d394/geode-core/src/main/java/org/apache/geode/distributed/internal/deadlock/GemFireDeadlockDetector.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/deadlock/GemFireDeadlockDetector.java
b/geode-core/src/main/java/org/apache/geode/distributed/internal/deadlock/GemFireDeadlockDetector.java
index 38c3dc4..9e45d74 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/deadlock/GemFireDeadlockDetector.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/deadlock/GemFireDeadlockDetector.java
@@ -96,8 +96,7 @@ public class GemFireDeadlockDetector {
     }
 
     ((AbstractExecution) execution).setIgnoreDepartedMembers(true);
-    collector = (ResultCollector<HashSet<Dependency>, Serializable>) execution
-        .execute(new CollectDependencyFunction());
+    collector = execution.execute(new CollectDependencyFunction());
 
     // Wait for results
     collector.getResult();

http://git-wip-us.apache.org/repos/asf/geode/blob/4816d394/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRClientServerTestBase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRClientServerTestBase.java
b/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRClientServerTestBase.java
index 6e50a0c..e98da5e 100755
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRClientServerTestBase.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRClientServerTestBase.java
@@ -718,8 +718,8 @@ public class PRClientServerTestBase extends JUnit4CacheTestCase {
     }
 
     List l = null;
-    ResultCollector<Integer, List<Integer>> rc = (ResultCollector<Integer,
List<Integer>>) dataSet
-        .withBucketFilter(bucketFilterSet).execute(function.getId());
+    ResultCollector<Integer, List<Integer>> rc =
+        dataSet.withBucketFilter(bucketFilterSet).execute(function.getId());
     List<Integer> results = rc.getResult();
     assertEquals(bucketFilterSet.size(), results.size());
     for (Integer bucket : results) {
@@ -754,8 +754,8 @@ public class PRClientServerTestBase extends JUnit4CacheTestCase {
     }
 
     List l = null;
-    ResultCollector<Integer, List<Integer>> rc = (ResultCollector<Integer,
List<Integer>>) dataSet
-        .withBucketFilter(bucketFilterSet).withFilter(ketFilterSet).execute(function.getId());
+    ResultCollector<Integer, List<Integer>> rc = dataSet.withBucketFilter(bucketFilterSet)
+        .withFilter(ketFilterSet).execute(function.getId());
     List<Integer> results = rc.getResult();
     assertEquals(expectedBucketSet.size(), results.size());
     for (Integer bucket : results) {

http://git-wip-us.apache.org/repos/asf/geode/blob/4816d394/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRFunctionExecutionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRFunctionExecutionDUnitTest.java
b/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRFunctionExecutionDUnitTest.java
index 9e9cc0c..9576330 100755
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRFunctionExecutionDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRFunctionExecutionDUnitTest.java
@@ -1580,8 +1580,7 @@ public class PRFunctionExecutionDUnitTest extends PartitionedRegionDUnitTestCase
         Set<Integer> bucketSet = new HashSet<Integer>();
         bucketSet.add(2);
         ResultCollector<Integer, List<Integer>> rc =
-            (ResultCollector<Integer, List<Integer>>) dataSet.withBucketFilter(bucketSet)
-                .execute(function);
+            dataSet.withBucketFilter(bucketSet).execute(function);
 
         List<Integer> results = rc.getResult();
         assertEquals(bucketSet.size(), results.size());
@@ -1604,8 +1603,7 @@ public class PRFunctionExecutionDUnitTest extends PartitionedRegionDUnitTestCase
         bucketSet.add(2);
         bucketSet.add(3);
         ResultCollector<Integer, List<Integer>> rc =
-            (ResultCollector<Integer, List<Integer>>) dataSet.withBucketFilter(bucketSet)
-                .execute(function);
+            dataSet.withBucketFilter(bucketSet).execute(function);
 
         List<Integer> results = rc.getResult();
         assertEquals(bucketSet.size(), results.size());
@@ -1631,8 +1629,7 @@ public class PRFunctionExecutionDUnitTest extends PartitionedRegionDUnitTestCase
         bucketSet.add(0);
         bucketSet.add(4);
         ResultCollector<Integer, List<Integer>> rc =
-            (ResultCollector<Integer, List<Integer>>) dataSet.withBucketFilter(bucketSet)
-                .execute(function);
+            dataSet.withBucketFilter(bucketSet).execute(function);
 
         List<Integer> results = rc.getResult();
         assertEquals(bucketSet.size(), results.size());
@@ -1713,8 +1710,7 @@ public class PRFunctionExecutionDUnitTest extends PartitionedRegionDUnitTestCase
         expectedBucketSet.add(3);
         expectedBucketSet.add(4);
         ResultCollector<Integer, List<Integer>> rc =
-            (ResultCollector<Integer, List<Integer>>) dataSet.withBucketFilter(bucketSet)
-                .withFilter(keySet).execute(function);
+            dataSet.withBucketFilter(bucketSet).withFilter(keySet).execute(function);
 
         List<Integer> results = rc.getResult();
         assertEquals(keySet.size(), results.size());

http://git-wip-us.apache.org/repos/asf/geode/blob/4816d394/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneQueryImpl.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneQueryImpl.java
b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneQueryImpl.java
index 9bdc935..8c9c798 100644
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneQueryImpl.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneQueryImpl.java
@@ -111,7 +111,7 @@ public class LuceneQueryImpl<K, V> implements LuceneQuery<K,
V> {
     try {
       TopEntriesFunctionCollector collector = new TopEntriesFunctionCollector(context);
       ResultCollector<TopEntriesCollector, TopEntries<K>> rc =
-          (ResultCollector<TopEntriesCollector, TopEntries<K>>) onRegion().withArgs(context)
+          onRegion().withArgs(context)
               .withCollector(collector).execute(LuceneQueryFunction.ID);
       entries = rc.getResult();
     } catch (FunctionException e) {


Mime
View raw message