lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From markrmil...@apache.org
Subject svn commit: r902815 - in /lucene/solr/branches/cloud/src/java/org/apache/solr/cloud: CloudState.java NodesWatcher.java Slice.java SolrZkServer.java ZkController.java ZkNodeProps.java ZooKeeperException.java
Date Mon, 25 Jan 2010 14:20:55 GMT
Author: markrmiller
Date: Mon Jan 25 14:20:54 2010
New Revision: 902815

URL: http://svn.apache.org/viewvc?rev=902815&view=rev
Log:
some cleanup

Modified:
    lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/CloudState.java
    lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/NodesWatcher.java
    lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/Slice.java
    lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/SolrZkServer.java
    lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/ZkController.java
    lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/ZkNodeProps.java
    lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/ZooKeeperException.java

Modified: lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/CloudState.java
URL: http://svn.apache.org/viewvc/lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/CloudState.java?rev=902815&r1=902814&r2=902815&view=diff
==============================================================================
--- lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/CloudState.java (original)
+++ lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/CloudState.java Mon Jan 25 14:20:54
2010
@@ -18,7 +18,6 @@
  */
 
 import java.util.Collections;
-import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
 
@@ -26,23 +25,18 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-// effectively immutable
+// immutable
 public class CloudState {
   protected static Logger log = LoggerFactory.getLogger(CloudState.class);
   
-  private Map<String,Map<String,Slice>> collectionStates = new HashMap<String,Map<String,Slice>>();
-  private Set<String> liveNodes = null;
+  private final Map<String,Map<String,Slice>> collectionStates;
+  private final Set<String> liveNodes;
   
-  public CloudState(Set<String> liveNodes) {
+  public CloudState(Set<String> liveNodes, Map<String,Map<String,Slice>>
collectionStates) {
     this.liveNodes = liveNodes;
+    this.collectionStates = collectionStates;
   }
   
-  // nocommit : only call before publishing
-  void addSlices(String collection, Map<String,Slice> slices) {
-    collectionStates.put(collection, slices);
-  }
-  
-  // nocommit
   public Map<String,Slice> getSlices(String collection) {
     Map<String,Slice> collectionState = collectionStates.get(collection);
     if(collectionState == null) {

Modified: lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/NodesWatcher.java
URL: http://svn.apache.org/viewvc/lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/NodesWatcher.java?rev=902815&r1=902814&r2=902815&view=diff
==============================================================================
--- lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/NodesWatcher.java (original)
+++ lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/NodesWatcher.java Mon Jan 25
14:20:54 2010
@@ -17,8 +17,6 @@
  * the License.
  */
 
-import java.io.IOException;
-
 import org.apache.solr.common.SolrException;
 import org.apache.zookeeper.KeeperException;
 import org.apache.zookeeper.WatchedEvent;

Modified: lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/Slice.java
URL: http://svn.apache.org/viewvc/lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/Slice.java?rev=902815&r1=902814&r2=902815&view=diff
==============================================================================
--- lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/Slice.java (original)
+++ lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/Slice.java Mon Jan 25 14:20:54
2010
@@ -20,7 +20,7 @@
 import java.util.Collections;
 import java.util.Map;
 
-// effectively immutable
+// immutable
 public class Slice {
   private final Map<String,ZkNodeProps> shards;
   private final String name;

Modified: lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/SolrZkServer.java
URL: http://svn.apache.org/viewvc/lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/SolrZkServer.java?rev=902815&r1=902814&r2=902815&view=diff
==============================================================================
--- lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/SolrZkServer.java (original)
+++ lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/SolrZkServer.java Mon Jan 25
14:20:54 2010
@@ -1,5 +1,22 @@
 package org.apache.solr.cloud;
 
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
 import org.apache.zookeeper.server.quorum.QuorumPeerConfig;
 import org.apache.zookeeper.server.quorum.QuorumPeer;
 import org.apache.zookeeper.server.quorum.QuorumPeerMain;

Modified: lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/ZkController.java
URL: http://svn.apache.org/viewvc/lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/ZkController.java?rev=902815&r1=902814&r2=902815&view=diff
==============================================================================
--- lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/ZkController.java (original)
+++ lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/ZkController.java Mon Jan 25
14:20:54 2010
@@ -94,8 +94,6 @@
 
   private String hostName;
 
-  private CoreContainer coreContainer;
-
 
   /**
    * @param zkServerAddress ZooKeeper server host address
@@ -111,7 +109,6 @@
   public ZkController(String zkServerAddress, int zkClientTimeout, String localHost, String
locaHostPort,
       String localHostContext, final CoreContainer coreContainer) throws InterruptedException,
       TimeoutException, IOException {
-    this.coreContainer = coreContainer;
     this.zkServerAddress = zkServerAddress;
     this.localHostPort = locaHostPort;
     this.localHostContext = localHostContext;
@@ -418,10 +415,11 @@
     log.info("Updating cloud state from ZooKeeper... :" + zkClient.keeper);
     
     // build immutable CloudInfo
-    CloudState cloudInfo = new CloudState(getLiveNodes());
+
 
     List<String> collections = getCollectionNames();
     // nocommit : load all collection info
+    Map<String,Map<String,Slice>> collectionStates = new HashMap<String,Map<String,Slice>>();
     for (String collection : collections) {
       String shardIdPaths = COLLECTIONS_ZKNODE + "/" + collection + SHARDS_ZKNODE;
       List<String> shardIdNames = zkClient.getChildren(shardIdPaths, null);
@@ -431,10 +429,12 @@
         Slice slice = new Slice(shardIdZkPath, shardsMap);
         slices.put(shardIdZkPath, slice);
       }
-      cloudInfo.addSlices(collection, slices);
+      collectionStates.put(collection, slices);
       
     }
-
+    
+    CloudState cloudInfo = new CloudState(getLiveNodes(), collectionStates);
+    
     // update volatile
     this.cloudState = cloudInfo;
   }

Modified: lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/ZkNodeProps.java
URL: http://svn.apache.org/viewvc/lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/ZkNodeProps.java?rev=902815&r1=902814&r2=902815&view=diff
==============================================================================
--- lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/ZkNodeProps.java (original)
+++ lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/ZkNodeProps.java Mon Jan 25
14:20:54 2010
@@ -1,5 +1,22 @@
 package org.apache.solr.cloud;
 
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 import java.io.IOException;
 import java.util.HashMap;
 import java.util.Set;

Modified: lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/ZooKeeperException.java
URL: http://svn.apache.org/viewvc/lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/ZooKeeperException.java?rev=902815&r1=902814&r2=902815&view=diff
==============================================================================
--- lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/ZooKeeperException.java (original)
+++ lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/ZooKeeperException.java Mon
Jan 25 14:20:54 2010
@@ -19,7 +19,6 @@
 
 
 import org.apache.solr.common.SolrException;
-import org.apache.solr.common.SolrException.ErrorCode;
 
 public class ZooKeeperException extends SolrException {
 



Mime
View raw message