SOLR-6116: Refactor DocRouter.getDocRouter to accept routerName as a String

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1598212 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Shalin Shekhar Mangar 2014-05-29 07:26:35 +00:00
parent cc199eb1af
commit a627b55bcd
3 changed files with 4 additions and 2 deletions

View File

@ -174,6 +174,8 @@ Other Changes
recovery scenarios after the leader receives an error trying to forward an recovery scenarios after the leader receives an error trying to forward an
update request to a replica. (Timothy Potter) update request to a replica. (Timothy Potter)
* SOLR-6116: Refactor DocRouter.getDocRouter to accept routerName as a String. (shalin)
Optimizations Optimizations
---------------------- ----------------------

View File

@ -303,7 +303,7 @@ public class ClusterState implements JSONWriter.Writable {
router = DocRouter.getDocRouter((String)routerObj); router = DocRouter.getDocRouter((String)routerObj);
} else { } else {
Map routerProps = (Map)routerObj; Map routerProps = (Map)routerObj;
router = DocRouter.getDocRouter(routerProps.get("name")); router = DocRouter.getDocRouter((String) routerProps.get("name"));
} }
return new DocCollection(name, slices, props, router, version); return new DocCollection(name, slices, props, router, version);

View File

@ -43,7 +43,7 @@ public abstract class DocRouter {
public static final DocRouter DEFAULT = new CompositeIdRouter(); public static final DocRouter DEFAULT = new CompositeIdRouter();
public static DocRouter getDocRouter(Object routerName) { public static DocRouter getDocRouter(String routerName) {
DocRouter router = routerMap.get(routerName); DocRouter router = routerMap.get(routerName);
if (router != null) return router; if (router != null) return router;
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Unknown document router '"+ routerName + "'"); throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Unknown document router '"+ routerName + "'");