incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [8/9] git commit: Removing collections4 as a dep.
Date Thu, 29 Jan 2015 15:15:43 GMT
Removing collections4 as a dep.


Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/c4105524
Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/c4105524
Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/c4105524

Branch: refs/heads/master
Commit: c4105524b4b1d1315627524ba46b66f7a3982a6b
Parents: c90708f
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Thu Jan 29 10:13:27 2015 -0500
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Thu Jan 29 10:14:17 2015 -0500

----------------------------------------------------------------------
 blur-console/pom.xml                            |  5 ---
 .../org/apache/blur/console/util/NodeUtil.java  | 37 ++++++++++++--------
 distribution/src/assemble/bin-hadoop1.xml       |  1 -
 distribution/src/assemble/bin-hadoop2.xml       |  1 -
 4 files changed, 23 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/c4105524/blur-console/pom.xml
----------------------------------------------------------------------
diff --git a/blur-console/pom.xml b/blur-console/pom.xml
index 9b0cbbf..6ef9012 100644
--- a/blur-console/pom.xml
+++ b/blur-console/pom.xml
@@ -66,11 +66,6 @@
       <version>1.1</version>
     </dependency>
     <dependency>
-      <groupId>org.apache.commons</groupId>
-      <artifactId>commons-collections4</artifactId>
-      <version>4.0</version>
-    </dependency>
-    <dependency>
       <groupId>commons-logging</groupId>
       <artifactId>commons-logging</artifactId>
     </dependency>

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/c4105524/blur-console/src/main/java/org/apache/blur/console/util/NodeUtil.java
----------------------------------------------------------------------
diff --git a/blur-console/src/main/java/org/apache/blur/console/util/NodeUtil.java b/blur-console/src/main/java/org/apache/blur/console/util/NodeUtil.java
index 5344609..cb26169 100644
--- a/blur-console/src/main/java/org/apache/blur/console/util/NodeUtil.java
+++ b/blur-console/src/main/java/org/apache/blur/console/util/NodeUtil.java
@@ -33,21 +33,19 @@ import java.util.Map;
 import java.util.Set;
 
 import org.apache.blur.thirdparty.thrift_0_9_0.TException;
-import org.apache.commons.collections4.CollectionUtils;
 
 public class NodeUtil {
   private static Set<String> onlineControllers = new HashSet<String>();
   private static Map<String, Set<String>> onlineShards = new HashMap<String,
Set<String>>();
 
-  @SuppressWarnings("unchecked")
   public static Map<String, Object> getControllerStatus() throws IOException, TException
{
     CachingBlurClient client = Config.getCachingBlurClient();
-    
+
     List<String> currentControllers = client.controllerList();
-    
-    Collection<String> newControllers = CollectionUtils.subtract(currentControllers,
onlineControllers);
-    Collection<String> missingControllers = CollectionUtils.subtract(onlineControllers,
currentControllers);
-    
+
+    Collection<String> newControllers = subtract(currentControllers, onlineControllers);
+    Collection<String> missingControllers = subtract(onlineControllers, currentControllers);
+
     onlineControllers.addAll(newControllers);
 
     Map<String, Object> data = new HashMap<String, Object>();
@@ -58,24 +56,35 @@ public class NodeUtil {
     return data;
   }
 
+  public static Collection<String> subtract(final Collection<String> a, final
Collection<String> b) {
+    final List<String> list = new ArrayList<String>();
+    final Set<String> bag = new HashSet<String>(b);
+    for (final String element : a) {
+      if (!bag.contains(element)) {
+        list.add(element);
+      }
+    }
+    return list;
+  }
+
   @SuppressWarnings("unchecked")
   public static List<Map<String, Object>> getClusterStatus() throws IOException,
TException {
     List<Map<String, Object>> data = new ArrayList<Map<String, Object>>();
     CachingBlurClient client = Config.getCachingBlurClient();
-    
+
     for (String cluster : client.shardClusterList()) {
       if (!onlineShards.containsKey(cluster)) {
         onlineShards.put(cluster, new HashSet<String>());
       }
-      
+
       Set<String> onlineShardsForCluster = onlineShards.get(cluster);
       List<String> currentShards = client.shardList(cluster);
-      
-      Collection<String> newShards = CollectionUtils.subtract(currentShards, onlineShardsForCluster);
-      Collection<String> missingShards = CollectionUtils.subtract(onlineShardsForCluster,
currentShards);
-      
+
+      Collection<String> newShards = subtract(currentShards, onlineShardsForCluster);
+      Collection<String> missingShards = subtract(onlineShardsForCluster, currentShards);
+
       onlineShardsForCluster.addAll(newShards);
-      
+
       Map<String, Object> clusterObj = new HashMap<String, Object>();
       clusterObj.put("name", cluster);
       clusterObj.put("online", onlineShardsForCluster);

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/c4105524/distribution/src/assemble/bin-hadoop1.xml
----------------------------------------------------------------------
diff --git a/distribution/src/assemble/bin-hadoop1.xml b/distribution/src/assemble/bin-hadoop1.xml
index b0e5e27..7fd3d15 100644
--- a/distribution/src/assemble/bin-hadoop1.xml
+++ b/distribution/src/assemble/bin-hadoop1.xml
@@ -43,7 +43,6 @@ under the License.
         <include>org.apache.lucene:*</include>
         <include>com.spatial4j:spatial4j</include>
         <include>commons-cli:commons-cli</include>
-        <include>org.apache.commons:commons-collections4</include>
         <include>org.eclipse.jetty:*</include>
         <include>com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru</include>
         <include>jline:jline</include>

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/c4105524/distribution/src/assemble/bin-hadoop2.xml
----------------------------------------------------------------------
diff --git a/distribution/src/assemble/bin-hadoop2.xml b/distribution/src/assemble/bin-hadoop2.xml
index bc4b526..0ca85d9 100644
--- a/distribution/src/assemble/bin-hadoop2.xml
+++ b/distribution/src/assemble/bin-hadoop2.xml
@@ -44,7 +44,6 @@ under the License.
         <include>org.apache.lucene:*</include>
         <include>com.spatial4j:spatial4j</include>
         <include>commons-cli:commons-cli</include>
-        <include>org.apache.commons:commons-collections4</include>
         <include>org.eclipse.jetty:*</include>
         <include>com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru</include>
         <include>jline:jline</include>


Mime
View raw message