You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by no...@apache.org on 2014/10/18 12:58:29 UTC

svn commit: r1632751 - /lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/common/cloud/ClusterState.java

Author: noble
Date: Sat Oct 18 10:58:29 2014
New Revision: 1632751

URL: http://svn.apache.org/r1632751
Log:
SOLR-6632

Modified:
    lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/common/cloud/ClusterState.java

Modified: lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/common/cloud/ClusterState.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/common/cloud/ClusterState.java?rev=1632751&r1=1632750&r2=1632751&view=diff
==============================================================================
--- lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/common/cloud/ClusterState.java (original)
+++ lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/common/cloud/ClusterState.java Sat Oct 18 10:58:29 2014
@@ -205,8 +205,10 @@ public class ClusterState implements JSO
       if (c != null) states = Collections.singletonList( c );
     }
 
-    for (CollectionRef coll : states) {
-      for (Slice slice : coll.get().getSlices()) {
+    for (CollectionRef ref : states) {
+      DocCollection coll = ref.get();
+      if(coll == null) continue;// this collection go tremoved in between, skip
+      for (Slice slice : coll.getSlices()) {
         for (Replica replica : slice.getReplicas()) {
           // TODO: for really large clusters, we could 'index' on this
           String rnodeName = replica.getStr(ZkStateReader.NODE_NAME_PROP);
@@ -220,25 +222,6 @@ public class ClusterState implements JSO
     return null;
   }
   
-  /*public String getShardIdByCoreNodeName(String collectionName, String coreNodeName) {
-    Collection<DocCollection> states = collectionStates.values();
-    if (collectionName != null) {
-      CollectionRef c = collectionStates.get(collectionName);
-      if (c != null) states = Collections.singletonList(c);
-    }
-
-    for (DocCollection coll : states) {
-      for (Slice slice : coll.getSlices()) {
-        for (Replica replica : slice.getReplicas()) {
-          if (coreNodeName.equals(replica.getName())) {
-            return slice.getName();
-          }
-        }
-      }
-    }
-    return null;
-  }*/
-
   /**
    * Check if node is alive. 
    */