You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2014/03/12 15:39:39 UTC
svn commit: r1576755 [17/27] - in /lucene/dev/trunk: lucene/
lucene/analysis/common/src/java/org/apache/lucene/analysis/charfilter/
lucene/analysis/common/src/java/org/apache/lucene/analysis/compound/
lucene/analysis/common/src/java/org/apache/lucene/a...
Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/analytics/request/AnalyticsRequestFactory.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/analytics/request/AnalyticsRequestFactory.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/analytics/request/AnalyticsRequestFactory.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/analytics/request/AnalyticsRequestFactory.java Wed Mar 12 14:39:17 2014
@@ -51,14 +51,14 @@ public class AnalyticsRequestFactory imp
public static final Pattern queryFacetParamPattern = Pattern.compile("^o(?:lap)?\\.([^\\.]+)\\.(?:"+QUERY_FACET+")\\.([^\\.]+)\\.("+QUERY+"|"+DEPENDENCY+")$", Pattern.CASE_INSENSITIVE);
public static List<AnalyticsRequest> parse(IndexSchema schema, SolrParams params) {
- Map<String, AnalyticsRequest> requestMap = new HashMap<String, AnalyticsRequest>();
- Map<String, Map<String,FieldFacetRequest>> fieldFacetMap = new HashMap<String, Map<String,FieldFacetRequest>>();
- Map<String, Set<String>> fieldFacetSet = new HashMap<String,Set<String>>();
- Map<String, Map<String,RangeFacetRequest>> rangeFacetMap = new HashMap<String, Map<String,RangeFacetRequest>>();
- Map<String, Set<String>> rangeFacetSet = new HashMap<String,Set<String>>();
- Map<String, Map<String,QueryFacetRequest>> queryFacetMap = new HashMap<String, Map<String,QueryFacetRequest>>();
- Map<String, Set<String>> queryFacetSet = new HashMap<String,Set<String>>();
- List<AnalyticsRequest> requestList = new ArrayList<AnalyticsRequest>();
+ Map<String, AnalyticsRequest> requestMap = new HashMap<>();
+ Map<String, Map<String,FieldFacetRequest>> fieldFacetMap = new HashMap<>();
+ Map<String, Set<String>> fieldFacetSet = new HashMap<>();
+ Map<String, Map<String,RangeFacetRequest>> rangeFacetMap = new HashMap<>();
+ Map<String, Set<String>> rangeFacetSet = new HashMap<>();
+ Map<String, Map<String,QueryFacetRequest>> queryFacetMap = new HashMap<>();
+ Map<String, Set<String>> queryFacetSet = new HashMap<>();
+ List<AnalyticsRequest> requestList = new ArrayList<>();
Iterator<String> paramsIterator = params.getParameterNamesIterator();
while (paramsIterator.hasNext()) {
@@ -115,7 +115,7 @@ public class AnalyticsRequestFactory imp
}
for (String reqName : requestMap.keySet()) {
AnalyticsRequest ar = requestMap.get(reqName);
- List<FieldFacetRequest> ffrs = new ArrayList<FieldFacetRequest>();
+ List<FieldFacetRequest> ffrs = new ArrayList<>();
if (fieldFacetSet.get(reqName)!=null) {
for (String field : fieldFacetSet.get(reqName)) {
ffrs.add(fieldFacetMap.get(reqName).get(field));
@@ -123,7 +123,7 @@ public class AnalyticsRequestFactory imp
}
ar.setFieldFacets(ffrs);
- List<RangeFacetRequest> rfrs = new ArrayList<RangeFacetRequest>();
+ List<RangeFacetRequest> rfrs = new ArrayList<>();
if (rangeFacetSet.get(reqName)!=null) {
for (String field : rangeFacetSet.get(reqName)) {
RangeFacetRequest rfr = rangeFacetMap.get(reqName).get(field);
@@ -134,7 +134,7 @@ public class AnalyticsRequestFactory imp
}
ar.setRangeFacets(rfrs);
- List<QueryFacetRequest> qfrs = new ArrayList<QueryFacetRequest>();
+ List<QueryFacetRequest> qfrs = new ArrayList<>();
if (queryFacetSet.get(reqName)!=null) {
for (String name : queryFacetSet.get(reqName)) {
QueryFacetRequest qfr = queryFacetMap.get(reqName).get(name);
@@ -157,12 +157,12 @@ public class AnalyticsRequestFactory imp
private static void makeFieldFacet(IndexSchema schema, Map<String, Map<String, FieldFacetRequest>> fieldFacetMap, Map<String, Set<String>> fieldFacetSet, String requestName, String[] fields) {
Map<String, FieldFacetRequest> facetMap = fieldFacetMap.get(requestName);
if (facetMap == null) {
- facetMap = new HashMap<String, FieldFacetRequest>();
+ facetMap = new HashMap<>();
fieldFacetMap.put(requestName, facetMap);
}
Set<String> set = fieldFacetSet.get(requestName);
if (set == null) {
- set = new HashSet<String>();
+ set = new HashSet<>();
fieldFacetSet.put(requestName, set);
}
for (String field : fields) {
@@ -176,7 +176,7 @@ public class AnalyticsRequestFactory imp
private static void setFieldFacetParam(IndexSchema schema, Map<String, Map<String, FieldFacetRequest>> fieldFacetMap, String requestName, String field, String paramType, String[] params) {
Map<String, FieldFacetRequest> facetMap = fieldFacetMap.get(requestName);
if (facetMap == null) {
- facetMap = new HashMap<String, FieldFacetRequest>();
+ facetMap = new HashMap<>();
fieldFacetMap.put(requestName, facetMap);
}
FieldFacetRequest fr = facetMap.get(field);
@@ -202,7 +202,7 @@ public class AnalyticsRequestFactory imp
private static void makeRangeFacet(IndexSchema schema, Map<String, Set<String>> rangeFacetSet, String requestName, String[] fields) {
Set<String> set = rangeFacetSet.get(requestName);
if (set == null) {
- set = new HashSet<String>();
+ set = new HashSet<>();
rangeFacetSet.put(requestName, set);
}
for (String field : fields) {
@@ -213,7 +213,7 @@ public class AnalyticsRequestFactory imp
private static void setRangeFacetParam(IndexSchema schema, Map<String, Map<String, RangeFacetRequest>> rangeFacetMap, String requestName, String field, String paramType, String[] params) {
Map<String, RangeFacetRequest> facetMap = rangeFacetMap.get(requestName);
if (facetMap == null) {
- facetMap = new HashMap<String, RangeFacetRequest>();
+ facetMap = new HashMap<>();
rangeFacetMap.put(requestName, facetMap);
}
RangeFacetRequest rr = facetMap.get(field);
@@ -243,7 +243,7 @@ public class AnalyticsRequestFactory imp
private static void makeQueryFacet(IndexSchema schema,Map<String, Set<String>> queryFacetSet, String requestName, String[] names) {
Set<String> set = queryFacetSet.get(requestName);
if (set == null) {
- set = new HashSet<String>();
+ set = new HashSet<>();
queryFacetSet.put(requestName, set);
}
for (String name : names) {
@@ -254,7 +254,7 @@ public class AnalyticsRequestFactory imp
private static void setQueryFacetParam(IndexSchema schema, Map<String, Map<String, QueryFacetRequest>> queryFacetMap, String requestName, String name, String paramType, String[] params) {
Map<String, QueryFacetRequest> facetMap = queryFacetMap.get(requestName);
if (facetMap == null) {
- facetMap = new HashMap<String, QueryFacetRequest>();
+ facetMap = new HashMap<>();
queryFacetMap.put(requestName, facetMap);
}
QueryFacetRequest qr = facetMap.get(name);
Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/analytics/request/AnalyticsStats.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/analytics/request/AnalyticsStats.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/analytics/request/AnalyticsStats.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/analytics/request/AnalyticsStats.java Wed Mar 12 14:39:17 2014
@@ -60,7 +60,7 @@ public class AnalyticsStats {
*/
public NamedList<?> execute() throws IOException {
statsCollector.startRequest();
- NamedList<Object> res = new NamedList<Object>();
+ NamedList<Object> res = new NamedList<>();
List<AnalyticsRequest> requests;
requests = AnalyticsRequestFactory.parse(searcher.getSchema(), params);
Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/analytics/request/QueryFacetRequest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/analytics/request/QueryFacetRequest.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/analytics/request/QueryFacetRequest.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/analytics/request/QueryFacetRequest.java Wed Mar 12 14:39:17 2014
@@ -31,13 +31,13 @@ public class QueryFacetRequest implement
private Set<String> dependencies;
public QueryFacetRequest() {
- dependencies = new HashSet<String>();
+ dependencies = new HashSet<>();
}
public QueryFacetRequest(String name) {
this.name = name;
- this.queries = new ArrayList<String>();
- dependencies = new HashSet<String>();
+ this.queries = new ArrayList<>();
+ dependencies = new HashSet<>();
}
public List<String> getQueries() {
Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/analytics/statistics/MedianStatsCollector.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/analytics/statistics/MedianStatsCollector.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/analytics/statistics/MedianStatsCollector.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/analytics/statistics/MedianStatsCollector.java Wed Mar 12 14:39:17 2014
@@ -28,7 +28,7 @@ import org.apache.solr.analytics.util.Me
*/
public class MedianStatsCollector extends AbstractDelegatingStatsCollector{
- private final List<Double> values = new ArrayList<Double>();
+ private final List<Double> values = new ArrayList<>();
protected double median;
public MedianStatsCollector(StatsCollector delegate) {
Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/analytics/statistics/PercentileStatsCollector.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/analytics/statistics/PercentileStatsCollector.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/analytics/statistics/PercentileStatsCollector.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/analytics/statistics/PercentileStatsCollector.java Wed Mar 12 14:39:17 2014
@@ -30,7 +30,7 @@ import com.google.common.collect.Iterabl
*/
@SuppressWarnings("rawtypes")
public class PercentileStatsCollector extends AbstractDelegatingStatsCollector{
- public final List<Comparable> values = new ArrayList<Comparable>();
+ public final List<Comparable> values = new ArrayList<>();
public static final Pattern PERCENTILE_PATTERN = Pattern.compile("perc(?:entile)?_(\\d+)",Pattern.CASE_INSENSITIVE);
protected final double[] percentiles;
protected final String[] percentileNames;
Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/analytics/statistics/StatsCollectorSupplierFactory.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/analytics/statistics/StatsCollectorSupplierFactory.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/analytics/statistics/StatsCollectorSupplierFactory.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/analytics/statistics/StatsCollectorSupplierFactory.java Wed Mar 12 14:39:17 2014
@@ -88,9 +88,9 @@ public class StatsCollectorSupplierFacto
*/
@SuppressWarnings("unchecked")
public static Supplier<StatsCollector[]> create(IndexSchema schema, AnalyticsRequest request) {
- final Map<String, Set<String>> collectorStats = new HashMap<String, Set<String>>();
- final Map<String, Set<Integer>> collectorPercs = new HashMap<String, Set<Integer>>();
- final Map<String, ValueSource> collectorSources = new HashMap<String, ValueSource>();
+ final Map<String, Set<String>> collectorStats = new HashMap<>();
+ final Map<String, Set<Integer>> collectorPercs = new HashMap<>();
+ final Map<String, ValueSource> collectorSources = new HashMap<>();
// Iterate through all expression request to make a list of ValueSource strings
// and statistics that need to be calculated on those ValueSources.
@@ -121,7 +121,7 @@ public class StatsCollectorSupplierFacto
source = arguments[1];
Set<Integer> percs = collectorPercs.get(source);
if (percs == null) {
- percs = new HashSet<Integer>();
+ percs = new HashSet<>();
collectorPercs.put(source, percs);
}
try {
@@ -143,7 +143,7 @@ public class StatsCollectorSupplierFacto
// each ValueSource, even across different expression requests
Set<String> stats = collectorStats.get(source);
if (stats == null) {
- stats = new HashSet<String>();
+ stats = new HashSet<>();
collectorStats.put(source, stats);
}
stats.add(stat);
@@ -244,7 +244,7 @@ public class StatsCollectorSupplierFacto
* @return The set of statistics (sum, mean, median, etc.) found in the expression
*/
public static Set<String> getStatistics(String expression) {
- HashSet<String> set = new HashSet<String>();
+ HashSet<String> set = new HashSet<>();
int firstParen = expression.indexOf('(');
if (firstParen>0) {
String topOperation = expression.substring(0,firstParen).trim();
@@ -511,7 +511,7 @@ public class StatsCollectorSupplierFacto
} else if (operation.equals(AnalyticsParams.FILTER)) {
return buildFilterSource(schema, operands, NUMBER_TYPE);
}
- List<ValueSource> subExpressions = new ArrayList<ValueSource>();
+ List<ValueSource> subExpressions = new ArrayList<>();
for (String argument : arguments) {
ValueSource argSource = buildNumericSource(schema, argument);
if (argSource == null) {
@@ -577,7 +577,7 @@ public class StatsCollectorSupplierFacto
return buildFilterSource(schema, operands, DATE_TYPE);
}
if (operation.equals(AnalyticsParams.DATE_MATH)) {
- List<ValueSource> subExpressions = new ArrayList<ValueSource>();
+ List<ValueSource> subExpressions = new ArrayList<>();
boolean first = true;
for (String argument : arguments) {
ValueSource argSource;
@@ -632,7 +632,7 @@ public class StatsCollectorSupplierFacto
}
return new ReverseStringFunction(buildStringSource(schema, operands));
}
- List<ValueSource> subExpressions = new ArrayList<ValueSource>();
+ List<ValueSource> subExpressions = new ArrayList<>();
for (String argument : arguments) {
subExpressions.add(buildSourceTree(schema, argument));
}
Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/analytics/statistics/UniqueStatsCollector.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/analytics/statistics/UniqueStatsCollector.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/analytics/statistics/UniqueStatsCollector.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/analytics/statistics/UniqueStatsCollector.java Wed Mar 12 14:39:17 2014
@@ -24,7 +24,7 @@ import java.util.Set;
* <code>UniqueValueCounter</code> computes the number of unique values.
*/
public class UniqueStatsCollector extends AbstractDelegatingStatsCollector{
- private final Set<Object> uniqueValues = new HashSet<Object>();
+ private final Set<Object> uniqueValues = new HashSet<>();
public UniqueStatsCollector(StatsCollector delegate) {
super(delegate);
Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/analytics/util/PercentileCalculator.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/analytics/util/PercentileCalculator.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/analytics/util/PercentileCalculator.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/analytics/util/PercentileCalculator.java Wed Mar 12 14:39:17 2014
@@ -46,7 +46,7 @@ public class PercentileCalculator {
throw new IllegalArgumentException();
}
- List<T> results = new ArrayList<T>(percs.length);
+ List<T> results = new ArrayList<>(percs.length);
distributeAndFind(list, percentiles, 0, percentiles.length - 1);
Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/analytics/util/RangeEndpointCalculator.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/analytics/util/RangeEndpointCalculator.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/analytics/util/RangeEndpointCalculator.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/analytics/util/RangeEndpointCalculator.java Wed Mar 12 14:39:17 2014
@@ -151,7 +151,7 @@ public abstract class RangeEndpointCalcu
T low = start;
- List<FacetRange> ranges = new ArrayList<FacetRange>();
+ List<FacetRange> ranges = new ArrayList<>();
int gapCounter = 0;
Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/client/solrj/embedded/JettySolrRunner.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/client/solrj/embedded/JettySolrRunner.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/client/solrj/embedded/JettySolrRunner.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/client/solrj/embedded/JettySolrRunner.java Wed Mar 12 14:39:17 2014
@@ -90,7 +90,7 @@ public class JettySolrRunner {
private String coreNodeName;
/** Maps servlet holders (i.e. factories: class + init params) to path specs */
- private SortedMap<ServletHolder,String> extraServlets = new TreeMap<ServletHolder,String>();
+ private SortedMap<ServletHolder,String> extraServlets = new TreeMap<>();
private SortedMap<Class,String> extraRequestFilters;
private LinkedList<FilterHolder> extraFilters;
@@ -106,7 +106,7 @@ public class JettySolrRunner {
}
// TODO: keep track of certain number of last requests
- private LinkedList<HttpServletRequest> requests = new LinkedList<HttpServletRequest>();
+ private LinkedList<HttpServletRequest> requests = new LinkedList<>();
@Override
@@ -188,7 +188,7 @@ public class JettySolrRunner {
SortedMap<Class,String> extraRequestFilters) {
if (null != extraServlets) { this.extraServlets.putAll(extraServlets); }
if (null != extraRequestFilters) {
- this.extraRequestFilters = new TreeMap<Class,String>(extraRequestFilters.comparator());
+ this.extraRequestFilters = new TreeMap<>(extraRequestFilters.comparator());
this.extraRequestFilters.putAll(extraRequestFilters);
}
this.solrConfigFilename = solrConfigFilename;
@@ -316,7 +316,7 @@ public class JettySolrRunner {
// FilterHolder fh = new FilterHolder(filter);
debugFilter = root.addFilter(DebugFilter.class, "*", EnumSet.of(DispatcherType.REQUEST) );
if (extraRequestFilters != null) {
- extraFilters = new LinkedList<FilterHolder>();
+ extraFilters = new LinkedList<>();
for (Class filterClass : extraRequestFilters.keySet()) {
extraFilters.add(root.addFilter(filterClass, extraRequestFilters.get(filterClass),
EnumSet.of(DispatcherType.REQUEST)));
Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/Assign.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/Assign.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/Assign.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/Assign.java Wed Mar 12 14:39:17 2014
@@ -86,7 +86,7 @@ public class Assign {
return "shard1";
}
- List<String> shardIdNames = new ArrayList<String>(sliceMap.keySet());
+ List<String> shardIdNames = new ArrayList<>(sliceMap.keySet());
if (shardIdNames.size() < numShards) {
return "shard" + (shardIdNames.size() + 1);
@@ -95,7 +95,7 @@ public class Assign {
// TODO: don't need to sort to find shard with fewest replicas!
// else figure out which shard needs more replicas
- final Map<String, Integer> map = new HashMap<String, Integer>();
+ final Map<String, Integer> map = new HashMap<>();
for (String shardId : shardIdNames) {
int cnt = sliceMap.get(shardId).getReplicasMap().size();
map.put(shardId, cnt);
@@ -135,12 +135,12 @@ public class Assign {
Set<String> nodes = clusterState.getLiveNodes();
- List<String> nodeList = new ArrayList<String>(nodes.size());
+ List<String> nodeList = new ArrayList<>(nodes.size());
nodeList.addAll(nodes);
if (createNodeList != null) nodeList.retainAll(createNodeList);
- HashMap<String,Node> nodeNameVsShardCount = new HashMap<String, Node>();
+ HashMap<String,Node> nodeNameVsShardCount = new HashMap<>();
for (String s : nodeList) nodeNameVsShardCount.put(s,new Node(s));
for (String s : clusterState.getCollections()) {
DocCollection c = clusterState.getCollection(s);
Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/DistributedQueue.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/DistributedQueue.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/DistributedQueue.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/DistributedQueue.java Wed Mar 12 14:39:17 2014
@@ -82,7 +82,7 @@ public class DistributedQueue {
*/
private TreeMap<Long,String> orderedChildren(Watcher watcher)
throws KeeperException, InterruptedException {
- TreeMap<Long,String> orderedChildren = new TreeMap<Long,String>();
+ TreeMap<Long,String> orderedChildren = new TreeMap<>();
List<String> childNames = null;
try {
Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/LeaderElector.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/LeaderElector.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/LeaderElector.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/LeaderElector.java Wed Mar 12 14:39:17 2014
@@ -212,7 +212,7 @@ public class LeaderElector {
* @return int seqs
*/
private List<Integer> getSeqs(List<String> seqs) {
- List<Integer> intSeqs = new ArrayList<Integer>(seqs.size());
+ List<Integer> intSeqs = new ArrayList<>(seqs.size());
for (String seq : seqs) {
intSeqs.add(getSeq(seq));
}
Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/Overseer.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/Overseer.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/Overseer.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/Overseer.java Wed Mar 12 14:39:17 2014
@@ -337,7 +337,7 @@ public class Overseer {
return clusterState;
}
- ArrayList<String> shardNames = new ArrayList<String>();
+ ArrayList<String> shardNames = new ArrayList<>();
if(ImplicitDocRouter.NAME.equals( message.getStr("router.name",DocRouter.DEFAULT_NAME))){
getShardNames(shardNames,message.getStr("shards",DocRouter.DEFAULT_NAME));
@@ -392,10 +392,10 @@ public class Overseer {
Map<String, RoutingRule> routingRules = slice.getRoutingRules();
if (routingRules == null)
- routingRules = new HashMap<String, RoutingRule>();
+ routingRules = new HashMap<>();
RoutingRule r = routingRules.get(routeKey);
if (r == null) {
- Map<String, Object> map = new HashMap<String, Object>();
+ Map<String, Object> map = new HashMap<>();
map.put("routeRanges", range);
map.put("targetCollection", targetCollection);
map.put("expireAt", expireAt);
@@ -463,7 +463,7 @@ public class Overseer {
Slice slice = clusterState.getSlice(collection, shardId);
if (slice == null) {
Map<String, Replica> replicas = Collections.EMPTY_MAP;
- Map<String, Object> sliceProps = new HashMap<String, Object>();
+ Map<String, Object> sliceProps = new HashMap<>();
String shardRange = message.getStr(ZkStateReader.SHARD_RANGE_PROP);
String shardState = message.getStr(ZkStateReader.SHARD_STATE_PROP);
String shardParent = message.getStr(ZkStateReader.SHARD_PARENT_PROP);
@@ -530,7 +530,7 @@ public class Overseer {
Integer numShards = message.getInt(ZkStateReader.NUM_SHARDS_PROP, null);
log.info("Update state numShards={} message={}", numShards, message);
- List<String> shardNames = new ArrayList<String>();
+ List<String> shardNames = new ArrayList<>();
//collection does not yet exist, create placeholders if num shards is specified
boolean collectionExists = clusterState.hasCollection(collection);
@@ -574,7 +574,7 @@ public class Overseer {
Slice slice = clusterState.getSlice(collection, sliceName);
- Map<String,Object> replicaProps = new LinkedHashMap<String,Object>();
+ Map<String,Object> replicaProps = new LinkedHashMap<>();
replicaProps.putAll(message.getProperties());
// System.out.println("########## UPDATE MESSAGE: " + JSONUtil.toJSON(message));
@@ -594,7 +594,7 @@ public class Overseer {
// remove any props with null values
Set<Entry<String,Object>> entrySet = replicaProps.entrySet();
- List<String> removeKeys = new ArrayList<String>();
+ List<String> removeKeys = new ArrayList<>();
for (Entry<String,Object> entry : entrySet) {
if (entry.getValue() == null) {
removeKeys.add(entry.getKey());
@@ -624,8 +624,8 @@ public class Overseer {
sliceProps = slice.getProperties();
replicas = slice.getReplicasCopy();
} else {
- replicas = new HashMap<String, Replica>(1);
- sliceProps = new HashMap<String, Object>();
+ replicas = new HashMap<>(1);
+ sliceProps = new HashMap<>();
sliceProps.put(Slice.RANGE, shardRange);
sliceProps.put(Slice.STATE, shardState);
sliceProps.put(Slice.PARENT, shardParent);
@@ -661,8 +661,8 @@ public class Overseer {
if (allActive) {
log.info("Shard: {} - all replicas are active. Finding status of fellow sub-shards", sliceName);
// find out about other sub shards
- Map<String, Slice> allSlicesCopy = new HashMap<String, Slice>(state.getSlicesMap(collection));
- List<Slice> subShardSlices = new ArrayList<Slice>();
+ Map<String, Slice> allSlicesCopy = new HashMap<>(state.getSlicesMap(collection));
+ List<Slice> subShardSlices = new ArrayList<>();
outer:
for (Entry<String, Slice> entry : allSlicesCopy.entrySet()) {
if (sliceName.equals(entry.getKey()))
@@ -688,7 +688,7 @@ public class Overseer {
log.info("Shard: {} - All replicas across all fellow sub-shards are now ACTIVE. Preparing to switch shard states.", sliceName);
String parentSliceName = (String) sliceProps.remove(Slice.PARENT);
- Map<String, Object> propMap = new HashMap<String, Object>();
+ Map<String, Object> propMap = new HashMap<>();
propMap.put(Overseer.QUEUE_OPERATION, "updateshardstate");
propMap.put(parentSliceName, Slice.INACTIVE);
propMap.put(sliceName, Slice.ACTIVE);
@@ -717,7 +717,7 @@ public class Overseer {
// Map<String, DocCollection> newCollections = new LinkedHashMap<String,DocCollection>();
- Map<String, Slice> newSlices = new LinkedHashMap<String,Slice>();
+ Map<String, Slice> newSlices = new LinkedHashMap<>();
// newCollections.putAll(state.getCollectionStates());
for (int i = 0; i < shards.size(); i++) {
String sliceName = shards.get(i);
@@ -725,14 +725,14 @@ public class Overseer {
for (int i = 0; i < numShards; i++) {
final String sliceName = "shard" + (i+1);*/
- Map<String, Object> sliceProps = new LinkedHashMap<String, Object>(1);
+ Map<String, Object> sliceProps = new LinkedHashMap<>(1);
sliceProps.put(Slice.RANGE, ranges == null? null: ranges.get(i));
newSlices.put(sliceName, new Slice(sliceName, null, sliceProps));
}
// TODO: fill in with collection properties read from the /collections/<collectionName> node
- Map<String,Object> collectionProps = new HashMap<String,Object>();
+ Map<String,Object> collectionProps = new HashMap<>();
for (Entry<String, Object> e : OverseerCollectionProcessor.COLL_PROPS.entrySet()) {
Object val = message.get(e.getKey());
@@ -791,7 +791,7 @@ public class Overseer {
private ClusterState updateSlice(ClusterState state, String collectionName, Slice slice) {
// System.out.println("###!!!### OLD CLUSTERSTATE: " + JSONUtil.toJSON(state.getCollectionStates()));
// System.out.println("Updating slice:" + slice);
- Map<String, DocCollection> newCollections = new LinkedHashMap<String,DocCollection>(state.getCollectionStates()); // make a shallow copy
+ Map<String, DocCollection> newCollections = new LinkedHashMap<>(state.getCollectionStates()); // make a shallow copy
DocCollection coll = newCollections.get(collectionName);
Map<String,Slice> slices;
Map<String,Object> props;
@@ -800,14 +800,14 @@ public class Overseer {
if (coll == null) {
// when updateSlice is called on a collection that doesn't exist, it's currently when a core is publishing itself
// without explicitly creating a collection. In this current case, we assume custom sharding with an "implicit" router.
- slices = new HashMap<String, Slice>(1);
- props = new HashMap<String,Object>(1);
+ slices = new HashMap<>(1);
+ props = new HashMap<>(1);
props.put(DocCollection.DOC_ROUTER, ZkNodeProps.makeMap("name",ImplicitDocRouter.NAME));
router = new ImplicitDocRouter();
} else {
props = coll.getProperties();
router = coll.getRouter();
- slices = new LinkedHashMap<String, Slice>(coll.getSlicesMap()); // make a shallow copy
+ slices = new LinkedHashMap<>(coll.getSlicesMap()); // make a shallow copy
}
slices.put(slice.getName(), slice);
DocCollection newCollection = new DocCollection(collectionName, slices, props, router);
@@ -820,7 +820,7 @@ public class Overseer {
private ClusterState setShardLeader(ClusterState state, String collectionName, String sliceName, String leaderUrl) {
- final Map<String, DocCollection> newCollections = new LinkedHashMap<String,DocCollection>(state.getCollectionStates());
+ final Map<String, DocCollection> newCollections = new LinkedHashMap<>(state.getCollectionStates());
DocCollection coll = newCollections.get(collectionName);
if(coll == null) {
log.error("Could not mark shard leader for non existing collection:" + collectionName);
@@ -829,7 +829,7 @@ public class Overseer {
Map<String, Slice> slices = coll.getSlicesMap();
// make a shallow copy and add it to the new collection
- slices = new LinkedHashMap<String,Slice>(slices);
+ slices = new LinkedHashMap<>(slices);
Slice slice = slices.get(sliceName);
if (slice == null) {
@@ -844,7 +844,7 @@ public class Overseer {
Replica oldLeader = slice.getLeader();
- final Map<String,Replica> newReplicas = new LinkedHashMap<String,Replica>();
+ final Map<String,Replica> newReplicas = new LinkedHashMap<>();
for (Replica replica : slice.getReplicas()) {
@@ -852,11 +852,11 @@ public class Overseer {
String coreURL = ZkCoreNodeProps.getCoreUrl(replica.getStr(ZkStateReader.BASE_URL_PROP), replica.getStr(ZkStateReader.CORE_NAME_PROP));
if (replica == oldLeader && !coreURL.equals(leaderUrl)) {
- Map<String,Object> replicaProps = new LinkedHashMap<String,Object>(replica.getProperties());
+ Map<String,Object> replicaProps = new LinkedHashMap<>(replica.getProperties());
replicaProps.remove(Slice.LEADER);
replica = new Replica(replica.getName(), replicaProps);
} else if (coreURL.equals(leaderUrl)) {
- Map<String,Object> replicaProps = new LinkedHashMap<String,Object>(replica.getProperties());
+ Map<String,Object> replicaProps = new LinkedHashMap<>(replica.getProperties());
replicaProps.put(Slice.LEADER, "true"); // TODO: allow booleans instead of strings
replica = new Replica(replica.getName(), replicaProps);
}
@@ -901,7 +901,7 @@ public class Overseer {
DocCollection coll = clusterState.getCollection(collection);
- Map<String, Slice> newSlices = new LinkedHashMap<String, Slice>(coll.getSlicesMap());
+ Map<String, Slice> newSlices = new LinkedHashMap<>(coll.getSlicesMap());
newSlices.remove(sliceId);
DocCollection newCollection = new DocCollection(coll.getName(), newSlices, coll.getProperties(), coll.getRouter());
@@ -916,7 +916,7 @@ public class Overseer {
final String collection = message.getStr(ZkStateReader.COLLECTION_PROP);
if (!checkCollectionKeyExistence(message)) return clusterState;
-// final Map<String, DocCollection> newCollections = new LinkedHashMap<String,DocCollection>(clusterState.getCollectionStates()); // shallow copy
+// final Map<String, DocCollection> newCollections = new LinkedHashMap<>(clusterState.getCollectionStates()); // shallow copy
// DocCollection coll = newCollections.get(collection);
DocCollection coll = clusterState.getCollectionOrNull(collection) ;
if (coll == null) {
@@ -933,7 +933,7 @@ public class Overseer {
return clusterState;
}
- Map<String, Slice> newSlices = new LinkedHashMap<String, Slice>();
+ Map<String, Slice> newSlices = new LinkedHashMap<>();
boolean lastSlice = false;
for (Slice slice : coll.getSlices()) {
Replica replica = slice.getReplica(cnn);
Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java Wed Mar 12 14:39:17 2014
@@ -245,7 +245,7 @@ public class OverseerCollectionProcessor
//
ArrayList<String> nodesTobePushedBack = new ArrayList<>();
//ensure that the node right behind the leader , i.r at position 1 is a Overseer
- List<String> availableDesignates = new ArrayList<String>();
+ List<String> availableDesignates = new ArrayList<>();
log.info("sorted nodes {}", nodeNames);//TODO to be removed
for (int i = 0; i < nodeNames.size(); i++) {
@@ -322,7 +322,7 @@ public class OverseerCollectionProcessor
children = zk.getChildren(OverseerElectionContext.PATH + LeaderElector.ELECTION_NODE, null, true);
} catch (Exception e) {
log.warn("error ", e);
- return new ArrayList<String>();
+ return new ArrayList<>();
}
LeaderElector.sortSeqs(children);
ArrayList<String> nodeNames = new ArrayList<>(children.size());
@@ -487,7 +487,7 @@ public class OverseerCollectionProcessor
}
Replica replica = slice.getReplica(replicaName);
if(replica == null){
- ArrayList<String> l = new ArrayList<String>();
+ ArrayList<String> l = new ArrayList<>();
for (Replica r : slice.getReplicas()) l.add(r.getName());
throw new SolrException(ErrorCode.BAD_REQUEST, "Invalid replica : " + replicaName + " in shard/collection : "
+ shard + "/"+ collectionName + " available replicas are "+ StrUtils.join(l,','));
@@ -607,8 +607,8 @@ public class OverseerCollectionProcessor
String aliasName = message.getStr("name");
String collections = message.getStr("collections");
- Map<String,Map<String,String>> newAliasesMap = new HashMap<String,Map<String,String>>();
- Map<String,String> newCollectionAliasesMap = new HashMap<String,String>();
+ Map<String,Map<String,String>> newAliasesMap = new HashMap<>();
+ Map<String,String> newCollectionAliasesMap = new HashMap<>();
Map<String,String> prevColAliases = aliases.getCollectionAliasMap();
if (prevColAliases != null) {
newCollectionAliasesMap.putAll(prevColAliases);
@@ -678,8 +678,8 @@ public class OverseerCollectionProcessor
private void deleteAlias(Aliases aliases, ZkNodeProps message) {
String aliasName = message.getStr("name");
- Map<String,Map<String,String>> newAliasesMap = new HashMap<String,Map<String,String>>();
- Map<String,String> newCollectionAliasesMap = new HashMap<String,String>();
+ Map<String,Map<String,String>> newAliasesMap = new HashMap<>();
+ Map<String,String> newCollectionAliasesMap = new HashMap<>();
newCollectionAliasesMap.putAll(aliases.getCollectionAliasMap());
newCollectionAliasesMap.remove(aliasName);
newAliasesMap.put("collection", newCollectionAliasesMap);
@@ -839,7 +839,7 @@ public class OverseerCollectionProcessor
if (ranges.length == 0 || ranges.length == 1) {
throw new SolrException(ErrorCode.BAD_REQUEST, "There must be at least two ranges specified to split a shard");
} else {
- subRanges = new ArrayList<DocRouter.Range>(ranges.length);
+ subRanges = new ArrayList<>(ranges.length);
for (int i = 0; i < ranges.length; i++) {
String r = ranges[i];
try {
@@ -852,7 +852,7 @@ public class OverseerCollectionProcessor
"Specified hash range: " + r + " is not a subset of parent shard's range: " + range.toString());
}
}
- List<DocRouter.Range> temp = new ArrayList<DocRouter.Range>(subRanges); // copy to preserve original order
+ List<DocRouter.Range> temp = new ArrayList<>(subRanges); // copy to preserve original order
Collections.sort(temp);
if (!range.equals(new DocRouter.Range(temp.get(0).min, temp.get(temp.size() - 1).max))) {
throw new SolrException(ErrorCode.BAD_REQUEST,
@@ -894,8 +894,8 @@ public class OverseerCollectionProcessor
}
try {
- List<String> subSlices = new ArrayList<String>(subRanges.size());
- List<String> subShardNames = new ArrayList<String>(subRanges.size());
+ List<String> subSlices = new ArrayList<>(subRanges.size());
+ List<String> subShardNames = new ArrayList<>(subRanges.size());
String nodeName = parentShardLeader.getNodeName();
for (int i = 0; i < subRanges.size(); i++) {
String subSlice = slice + "_" + i;
@@ -911,7 +911,7 @@ public class OverseerCollectionProcessor
// delete the shards
for (String sub : subSlices) {
log.info("Sub-shard: {} already exists therefore requesting its deletion", sub);
- Map<String, Object> propMap = new HashMap<String, Object>();
+ Map<String, Object> propMap = new HashMap<>();
propMap.put(Overseer.QUEUE_OPERATION, "deleteshard");
propMap.put(COLLECTION_PROP, collectionName);
propMap.put(SHARD_ID_PROP, sub);
@@ -940,7 +940,7 @@ public class OverseerCollectionProcessor
+ subSlice + " of collection " + collectionName + " on "
+ nodeName);
- Map<String, Object> propMap = new HashMap<String, Object>();
+ Map<String, Object> propMap = new HashMap<>();
propMap.put(Overseer.QUEUE_OPERATION, "createshard");
propMap.put(ZkStateReader.SHARD_ID_PROP, subSlice);
propMap.put(ZkStateReader.COLLECTION_PROP, collectionName);
@@ -1037,7 +1037,7 @@ public class OverseerCollectionProcessor
// node?
// for now we just go random
Set<String> nodes = clusterState.getLiveNodes();
- List<String> nodeList = new ArrayList<String>(nodes.size());
+ List<String> nodeList = new ArrayList<>(nodes.size());
nodeList.addAll(nodes);
Collections.shuffle(nodeList);
@@ -1101,7 +1101,7 @@ public class OverseerCollectionProcessor
// switch sub shard states to 'active'
log.info("Replication factor is 1 so switching shard states");
DistributedQueue inQueue = Overseer.getInQueue(zkStateReader.getZkClient());
- Map<String, Object> propMap = new HashMap<String, Object>();
+ Map<String, Object> propMap = new HashMap<>();
propMap.put(Overseer.QUEUE_OPERATION, "updateshardstate");
propMap.put(slice, Slice.INACTIVE);
for (String subSlice : subSlices) {
@@ -1113,7 +1113,7 @@ public class OverseerCollectionProcessor
} else {
log.info("Requesting shard state be set to 'recovery'");
DistributedQueue inQueue = Overseer.getInQueue(zkStateReader.getZkClient());
- Map<String, Object> propMap = new HashMap<String, Object>();
+ Map<String, Object> propMap = new HashMap<>();
propMap.put(Overseer.QUEUE_OPERATION, "updateshardstate");
for (String subSlice : subSlices) {
propMap.put(subSlice, Slice.RECOVERY);
@@ -1576,7 +1576,7 @@ public class OverseerCollectionProcessor
// node?
// for now we just go random
Set<String> nodes = clusterState.getLiveNodes();
- List<String> nodeList = new ArrayList<String>(nodes.size());
+ List<String> nodeList = new ArrayList<>(nodes.size());
nodeList.addAll(nodes);
if (createNodeList != null) nodeList.retainAll(createNodeList);
Collections.shuffle(nodeList);
@@ -1628,7 +1628,7 @@ public class OverseerCollectionProcessor
throw new SolrException(ErrorCode.SERVER_ERROR, "Could not fully createcollection: " + message.getStr("name"));
log.info("Creating SolrCores for new collection, shardNames {} , replicationFactor : {}", shardNames, repFactor);
- Map<String ,ShardRequest> coresToCreate = new LinkedHashMap<String, ShardRequest>();
+ Map<String ,ShardRequest> coresToCreate = new LinkedHashMap<>();
for (int i = 1; i <= shardNames.size(); i++) {
String sliceName = shardNames.get(i-1);
for (int j = 1; j <= repFactor; j++) {
@@ -1708,7 +1708,7 @@ public class OverseerCollectionProcessor
}
private Map<String, Replica> waitToSeeReplicasInState(String collectionName, Collection<String> coreNames) throws InterruptedException {
- Map<String, Replica> result = new HashMap<String, Replica>();
+ Map<String, Replica> result = new HashMap<>();
long endTime = System.nanoTime() + TimeUnit.NANOSECONDS.convert(30, TimeUnit.SECONDS);
while (true) {
DocCollection coll = zkStateReader.getClusterState().getCollection(
Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/RecoveryStrategy.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/RecoveryStrategy.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/RecoveryStrategy.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/RecoveryStrategy.java Wed Mar 12 14:39:17 2014
@@ -284,7 +284,7 @@ public class RecoveryStrategy extends Th
recentVersions = recentUpdates.getVersions(ulog.numRecordsToKeep);
} catch (Exception e) {
SolrException.log(log, "Corrupt tlog - ignoring. core=" + coreName, e);
- recentVersions = new ArrayList<Long>(0);
+ recentVersions = new ArrayList<>(0);
} finally {
if (recentUpdates != null) {
recentUpdates.close();
@@ -313,7 +313,7 @@ public class RecoveryStrategy extends Th
log.info("###### startupVersions=" + startingVersions);
} catch (Exception e) {
SolrException.log(log, "Error getting recent versions. core=" + coreName, e);
- recentVersions = new ArrayList<Long>(0);
+ recentVersions = new ArrayList<>(0);
}
}
Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/SyncStrategy.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/SyncStrategy.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/SyncStrategy.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/SyncStrategy.java Wed Mar 12 14:39:17 2014
@@ -158,7 +158,7 @@ public class SyncStrategy {
return true;
}
- List<String> syncWith = new ArrayList<String>();
+ List<String> syncWith = new ArrayList<>();
for (ZkCoreNodeProps node : nodes) {
syncWith.add(node.getCoreUrl());
}
Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/ZkController.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/ZkController.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/ZkController.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/ZkController.java Wed Mar 12 14:39:17 2014
@@ -578,7 +578,7 @@ public final class ZkController {
ClusterState clusterState = zkStateReader.getClusterState();
Set<String> collections = clusterState.getCollections();
- List<String> updatedNodes = new ArrayList<String>();
+ List<String> updatedNodes = new ArrayList<>();
for (String collectionName : collections) {
DocCollection collection = clusterState.getCollection(collectionName);
Collection<Slice> slices = collection.getSlices();
@@ -755,7 +755,7 @@ public final class ZkController {
String shardId = cloudDesc.getShardId();
- Map<String,Object> props = new HashMap<String,Object>();
+ Map<String,Object> props = new HashMap<>();
// we only put a subset of props into the leader node
props.put(ZkStateReader.BASE_URL_PROP, baseUrl);
props.put(ZkStateReader.CORE_NAME_PROP, coreName);
@@ -948,7 +948,7 @@ public final class ZkController {
String shardId = cd.getCloudDescriptor().getShardId();
- Map<String,Object> props = new HashMap<String,Object>();
+ Map<String,Object> props = new HashMap<>();
// we only put a subset of props into the leader node
props.put(ZkStateReader.BASE_URL_PROP, getBaseUrl());
props.put(ZkStateReader.CORE_NAME_PROP, cd.getName());
@@ -1131,7 +1131,7 @@ public final class ZkController {
SolrParams params = cd.getParams();
try {
- Map<String,Object> collectionProps = new HashMap<String,Object>();
+ Map<String,Object> collectionProps = new HashMap<>();
// TODO: if collection.configName isn't set, and there isn't already a conf in zk, just use that?
String defaultConfigName = System.getProperty(COLLECTION_PARAM_PREFIX+CONFIGNAME_PROP, collection);
@@ -1540,7 +1540,7 @@ public final class ZkController {
ZkNodeProps props = null;
if(data != null) {
props = ZkNodeProps.load(data);
- Map<String,Object> newProps = new HashMap<String,Object>();
+ Map<String,Object> newProps = new HashMap<>();
newProps.putAll(props.getProperties());
newProps.put(CONFIGNAME_PROP, confSetName);
props = new ZkNodeProps(newProps);
Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/CachingDirectoryFactory.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/CachingDirectoryFactory.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/CachingDirectoryFactory.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/CachingDirectoryFactory.java Wed Mar 12 14:39:17 2014
@@ -76,8 +76,8 @@ public abstract class CachingDirectoryFa
public boolean closeCacheValueCalled = false;
public boolean doneWithDir = false;
private boolean deleteAfterCoreClose = false;
- public Set<CacheValue> removeEntries = new HashSet<CacheValue>();
- public Set<CacheValue> closeEntries = new HashSet<CacheValue>();
+ public Set<CacheValue> removeEntries = new HashSet<>();
+ public Set<CacheValue> closeEntries = new HashSet<>();
public void setDeleteOnClose(boolean deleteOnClose, boolean deleteAfterCoreClose) {
if (deleteOnClose) {
@@ -96,13 +96,13 @@ public abstract class CachingDirectoryFa
private static Logger log = LoggerFactory
.getLogger(CachingDirectoryFactory.class);
- protected Map<String,CacheValue> byPathCache = new HashMap<String,CacheValue>();
+ protected Map<String,CacheValue> byPathCache = new HashMap<>();
- protected Map<Directory,CacheValue> byDirectoryCache = new IdentityHashMap<Directory,CacheValue>();
+ protected Map<Directory,CacheValue> byDirectoryCache = new IdentityHashMap<>();
- protected Map<Directory,List<CloseListener>> closeListeners = new HashMap<Directory,List<CloseListener>>();
+ protected Map<Directory,List<CloseListener>> closeListeners = new HashMap<>();
- protected Set<CacheValue> removeEntries = new HashSet<CacheValue>();
+ protected Set<CacheValue> removeEntries = new HashSet<>();
private Double maxWriteMBPerSecFlush;
@@ -129,7 +129,7 @@ public abstract class CachingDirectoryFa
}
List<CloseListener> listeners = closeListeners.get(dir);
if (listeners == null) {
- listeners = new ArrayList<CloseListener>();
+ listeners = new ArrayList<>();
closeListeners.put(dir, listeners);
}
listeners.add(closeListener);
@@ -192,7 +192,7 @@ public abstract class CachingDirectoryFa
}
values = byDirectoryCache.values();
- Set<CacheValue> closedDirs = new HashSet<CacheValue>();
+ Set<CacheValue> closedDirs = new HashSet<>();
for (CacheValue val : values) {
try {
for (CacheValue v : val.closeEntries) {
@@ -248,7 +248,7 @@ public abstract class CachingDirectoryFa
// see if we are a subpath
Collection<CacheValue> values = byPathCache.values();
- Collection<CacheValue> cacheValues = new ArrayList<CacheValue>(values);
+ Collection<CacheValue> cacheValues = new ArrayList<>(values);
cacheValues.remove(cacheValue);
for (CacheValue otherCacheValue : cacheValues) {
// if we are a parent path and a sub path is not already closed, get a sub path to close us later
@@ -556,7 +556,7 @@ public abstract class CachingDirectoryFa
* @lucene.internal
*/
public synchronized Set<String> getLivePaths() {
- HashSet<String> livePaths = new HashSet<String>();
+ HashSet<String> livePaths = new HashSet<>();
for (CacheValue val : byPathCache.values()) {
if (!val.doneWithDir) {
livePaths.add(val.path);
Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/Config.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/Config.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/Config.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/Config.java Wed Mar 12 14:39:17 2014
@@ -301,14 +301,14 @@ public class Config {
* or null if all attributes are known.
*/
public Set<String> getUnknownAttributes(Element element, String... knownAttributes) {
- Set<String> knownAttributeSet = new HashSet<String>(Arrays.asList(knownAttributes));
+ Set<String> knownAttributeSet = new HashSet<>(Arrays.asList(knownAttributes));
Set<String> unknownAttributeSet = null;
NamedNodeMap attributes = element.getAttributes();
for (int i = 0 ; i < attributes.getLength() ; ++i) {
final String attributeName = attributes.item(i).getNodeName();
if ( ! knownAttributeSet.contains(attributeName)) {
if (null == unknownAttributeSet) {
- unknownAttributeSet = new HashSet<String>();
+ unknownAttributeSet = new HashSet<>();
}
unknownAttributeSet.add(attributeName);
}
@@ -321,7 +321,7 @@ public class Config {
* contains an attribute name that is not among knownAttributes.
*/
public void complainAboutUnknownAttributes(String elementXpath, String... knownAttributes) {
- SortedMap<String,SortedSet<String>> problems = new TreeMap<String,SortedSet<String>>();
+ SortedMap<String,SortedSet<String>> problems = new TreeMap<>();
NodeList nodeList = getNodeList(elementXpath, false);
for (int i = 0 ; i < nodeList.getLength() ; ++i) {
Element element = (Element)nodeList.item(i);
@@ -330,7 +330,7 @@ public class Config {
String elementName = element.getNodeName();
SortedSet<String> allUnknownAttributes = problems.get(elementName);
if (null == allUnknownAttributes) {
- allUnknownAttributes = new TreeSet<String>();
+ allUnknownAttributes = new TreeSet<>();
problems.put(elementName, allUnknownAttributes);
}
allUnknownAttributes.addAll(unknownAttributes);
Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/ConfigSolr.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/ConfigSolr.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/ConfigSolr.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/ConfigSolr.java Wed Mar 12 14:39:17 2014
@@ -269,7 +269,7 @@ public abstract class ConfigSolr {
}
protected Config config;
- protected Map<CfgProp, String> propMap = new HashMap<CfgProp, String>();
+ protected Map<CfgProp, String> propMap = new HashMap<>();
public ConfigSolr(Config config) {
this.config = config;
Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/ConfigSolrXmlOld.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/ConfigSolrXmlOld.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/ConfigSolrXmlOld.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/ConfigSolrXmlOld.java Wed Mar 12 14:39:17 2014
@@ -186,8 +186,8 @@ public class ConfigSolrXmlOld extends Co
coreNodes = (NodeList) config.evaluate("solr/cores/core",
XPathConstants.NODESET);
// Check a couple of error conditions
- Set<String> names = new HashSet<String>(); // for duplicate names
- Map<String,String> dirs = new HashMap<String,String>(); // for duplicate
+ Set<String> names = new HashSet<>(); // for duplicate names
+ Map<String,String> dirs = new HashMap<>(); // for duplicate
// data dirs.
for (int idx = 0; idx < coreNodes.getLength(); ++idx) {
@@ -236,7 +236,7 @@ public class ConfigSolrXmlOld extends Co
}
public List<String> getAllCoreNames() {
- List<String> ret = new ArrayList<String>();
+ List<String> ret = new ArrayList<>();
synchronized (coreNodes) {
for (int idx = 0; idx < coreNodes.getLength(); ++idx) {
Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/CoreContainer.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/CoreContainer.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/CoreContainer.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/CoreContainer.java Wed Mar 12 14:39:17 2014
@@ -206,7 +206,7 @@ public class CoreContainer {
shareSchema = cfg.hasSchemaCache();
if (shareSchema) {
- indexSchemaCache = new ConcurrentHashMap<String,IndexSchema>();
+ indexSchemaCache = new ConcurrentHashMap<>();
}
hostName = cfg.getHost();
@@ -227,10 +227,10 @@ public class CoreContainer {
new DefaultSolrThreadFactory("coreLoadExecutor") );
try {
- CompletionService<SolrCore> completionService = new ExecutorCompletionService<SolrCore>(
+ CompletionService<SolrCore> completionService = new ExecutorCompletionService<>(
coreLoadExecutor);
- Set<Future<SolrCore>> pending = new HashSet<Future<SolrCore>>();
+ Set<Future<SolrCore>> pending = new HashSet<>();
List<CoreDescriptor> cds = coresLocator.discover(this);
checkForDuplicateCoreNames(cds);
@@ -657,7 +657,7 @@ public class CoreContainer {
*/
public Map<String,Exception> getCoreInitFailures() {
synchronized ( coreInitFailures ) {
- return Collections.unmodifiableMap(new LinkedHashMap<String,Exception>
+ return Collections.unmodifiableMap(new LinkedHashMap<>
(coreInitFailures));
}
}
Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/IndexDeletionPolicyWrapper.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/IndexDeletionPolicyWrapper.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/IndexDeletionPolicyWrapper.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/IndexDeletionPolicyWrapper.java Wed Mar 12 14:39:17 2014
@@ -44,10 +44,10 @@ import java.util.concurrent.atomic.Atomi
*/
public final class IndexDeletionPolicyWrapper extends IndexDeletionPolicy {
private final IndexDeletionPolicy deletionPolicy;
- private volatile Map<Long, IndexCommit> solrVersionVsCommits = new ConcurrentHashMap<Long, IndexCommit>();
- private final Map<Long, Long> reserves = new ConcurrentHashMap<Long,Long>();
+ private volatile Map<Long, IndexCommit> solrVersionVsCommits = new ConcurrentHashMap<>();
+ private final Map<Long, Long> reserves = new ConcurrentHashMap<>();
private volatile IndexCommit latestCommit;
- private final ConcurrentHashMap<Long, AtomicInteger> savedCommits = new ConcurrentHashMap<Long, AtomicInteger>();
+ private final ConcurrentHashMap<Long, AtomicInteger> savedCommits = new ConcurrentHashMap<>();
public IndexDeletionPolicyWrapper(IndexDeletionPolicy deletionPolicy) {
this.deletionPolicy = deletionPolicy;
@@ -102,7 +102,7 @@ public final class IndexDeletionPolicyWr
}
private List<IndexCommitWrapper> wrap(List<? extends IndexCommit> list) {
- List<IndexCommitWrapper> result = new ArrayList<IndexCommitWrapper>();
+ List<IndexCommitWrapper> result = new ArrayList<>();
for (IndexCommit indexCommit : list) result.add(new IndexCommitWrapper(indexCommit));
return result;
}
@@ -232,7 +232,7 @@ public final class IndexDeletionPolicyWr
}
private void updateCommitPoints(List<IndexCommitWrapper> list) {
- Map<Long, IndexCommit> map = new ConcurrentHashMap<Long, IndexCommit>();
+ Map<Long, IndexCommit> map = new ConcurrentHashMap<>();
for (IndexCommitWrapper wrapper : list) {
if (!wrapper.isDeleted())
map.put(wrapper.delegate.getGeneration(), wrapper.delegate);
Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/JmxMonitoredMap.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/JmxMonitoredMap.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/JmxMonitoredMap.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/JmxMonitoredMap.java Wed Mar 12 14:39:17 2014
@@ -182,7 +182,7 @@ public class JmxMonitoredMap<K, V> exten
private ObjectName getObjectName(String key, SolrInfoMBean infoBean)
throws MalformedObjectNameException {
- Hashtable<String, String> map = new Hashtable<String, String>();
+ Hashtable<String, String> map = new Hashtable<>();
map.put("type", key);
if (infoBean.getName() != null && !"".equals(infoBean.getName())) {
map.put("id", infoBean.getName());
@@ -208,7 +208,7 @@ public class JmxMonitoredMap<K, V> exten
public SolrDynamicMBean(String coreHashCode, SolrInfoMBean managedResource) {
this.infoBean = managedResource;
- staticStats = new HashSet<String>();
+ staticStats = new HashSet<>();
// For which getters are already available in SolrInfoMBean
staticStats.add("name");
@@ -221,7 +221,7 @@ public class JmxMonitoredMap<K, V> exten
@Override
public MBeanInfo getMBeanInfo() {
- ArrayList<MBeanAttributeInfo> attrInfoList = new ArrayList<MBeanAttributeInfo>();
+ ArrayList<MBeanAttributeInfo> attrInfoList = new ArrayList<>();
for (String stat : staticStats) {
attrInfoList.add(new MBeanAttributeInfo(stat, String.class.getName(),
Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/PluginInfo.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/PluginInfo.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/PluginInfo.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/PluginInfo.java Wed Mar 12 14:39:17 2014
@@ -55,7 +55,7 @@ public class PluginInfo {
}
private List<PluginInfo> loadSubPlugins(Node node) {
- List<PluginInfo> children = new ArrayList<PluginInfo>();
+ List<PluginInfo> children = new ArrayList<>();
//if there is another sub tag with a non namedlist tag that has to be another plugin
NodeList nlst = node.getChildNodes();
for (int i = 0; i < nlst.getLength(); i++) {
@@ -99,13 +99,13 @@ public class PluginInfo {
*/
public List<PluginInfo> getChildren(String type){
if(children.isEmpty()) return children;
- List<PluginInfo> result = new ArrayList<PluginInfo>();
+ List<PluginInfo> result = new ArrayList<>();
for (PluginInfo child : children) if(type.equals(child.type)) result.add(child);
return result;
}
public static final PluginInfo EMPTY_INFO = new PluginInfo("",Collections.<String,String>emptyMap(), new NamedList(),Collections.<PluginInfo>emptyList());
- private static final HashSet<String> NL_TAGS = new HashSet<String>
+ private static final HashSet<String> NL_TAGS = new HashSet<>
(Arrays.asList("lst", "arr",
"bool",
"str",
Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/RequestHandlers.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/RequestHandlers.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/RequestHandlers.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/RequestHandlers.java Wed Mar 12 14:39:17 2014
@@ -45,7 +45,7 @@ public final class RequestHandlers {
// Use a synchronized map - since the handlers can be changed at runtime,
// the map implementation should be thread safe
private final Map<String, SolrRequestHandler> handlers =
- new ConcurrentHashMap<String,SolrRequestHandler>() ;
+ new ConcurrentHashMap<>() ;
/**
* Trim the trailing '/' if its there, and convert null to empty string.
@@ -80,7 +80,7 @@ public final class RequestHandlers {
* @return a Map of all registered handlers of the specified type.
*/
public <T extends SolrRequestHandler> Map<String,T> getAll(Class<T> clazz) {
- Map<String,T> result = new HashMap<String,T>(7);
+ Map<String,T> result = new HashMap<>(7);
for (Map.Entry<String,SolrRequestHandler> e : handlers.entrySet()) {
if(clazz.isInstance(e.getValue())) result.put(e.getKey(), clazz.cast(e.getValue()));
}
@@ -137,7 +137,7 @@ public final class RequestHandlers {
void initHandlersFromConfig(SolrConfig config ){
// use link map so we iterate in the same order
- Map<PluginInfo,SolrRequestHandler> handlers = new LinkedHashMap<PluginInfo,SolrRequestHandler>();
+ Map<PluginInfo,SolrRequestHandler> handlers = new LinkedHashMap<>();
for (PluginInfo info : config.getPluginInfos(SolrRequestHandler.class.getName())) {
try {
SolrRequestHandler requestHandler;
@@ -317,7 +317,7 @@ public final class RequestHandlers {
if( _handler != null ) {
return _handler.getStatistics();
}
- NamedList<String> lst = new SimpleOrderedMap<String>();
+ NamedList<String> lst = new SimpleOrderedMap<>();
lst.add("note", "not initialized yet" );
return lst;
}
Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/SolrConfig.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/SolrConfig.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/SolrConfig.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/SolrConfig.java Wed Mar 12 14:39:17 2014
@@ -193,7 +193,7 @@ public class SolrConfig extends Config {
documentCacheConfig = CacheConfig.getConfig(this, "query/documentCache");
CacheConfig conf = CacheConfig.getConfig(this, "query/fieldValueCache");
if (conf == null) {
- Map<String,String> args = new HashMap<String,String>();
+ Map<String,String> args = new HashMap<>();
args.put("name","fieldValueCache");
args.put("size","10000");
args.put("initialSize","10");
@@ -318,7 +318,7 @@ public class SolrConfig extends Config {
}
public List<PluginInfo> readPluginInfos(String tag, boolean requireName, boolean requireClass) {
- ArrayList<PluginInfo> result = new ArrayList<PluginInfo>();
+ ArrayList<PluginInfo> result = new ArrayList<>();
NodeList nodes = (NodeList) evaluate(tag, XPathConstants.NODESET);
for (int i=0; i<nodes.getLength(); i++) {
PluginInfo pluginInfo = new PluginInfo(nodes.item(i), "[solrconfig.xml] " + tag, requireName, requireClass);
@@ -362,7 +362,7 @@ public class SolrConfig extends Config {
protected UpdateHandlerInfo updateHandlerInfo ;
- private Map<String, List<PluginInfo>> pluginStore = new LinkedHashMap<String, List<PluginInfo>>();
+ private Map<String, List<PluginInfo>> pluginStore = new LinkedHashMap<>();
public final int maxWarmingSearchers;
public final boolean unlockOnStartup;
Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/SolrCore.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/SolrCore.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/SolrCore.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/SolrCore.java Wed Mar 12 14:39:17 2014
@@ -360,8 +360,8 @@ public final class SolrCore implements S
}
}
- final List<SolrEventListener> firstSearcherListeners = new ArrayList<SolrEventListener>();
- final List<SolrEventListener> newSearcherListeners = new ArrayList<SolrEventListener>();
+ final List<SolrEventListener> firstSearcherListeners = new ArrayList<>();
+ final List<SolrEventListener> newSearcherListeners = new ArrayList<>();
/**
* NOTE: this function is not thread safe. However, it is safe to call within the
@@ -464,7 +464,7 @@ public final class SolrCore implements S
}
// protect via synchronized(SolrCore.class)
- private static Set<String> dirs = new HashSet<String>();
+ private static Set<String> dirs = new HashSet<>();
void initIndex(boolean reload) throws IOException {
@@ -716,7 +716,7 @@ public final class SolrCore implements S
infoRegistry = new JmxMonitoredMap<String, SolrInfoMBean>(name, String.valueOf(this.hashCode()), config.jmxConfig);
} else {
log.info("JMX monitoring not detected for core: " + name);
- infoRegistry = new ConcurrentHashMap<String, SolrInfoMBean>();
+ infoRegistry = new ConcurrentHashMap<>();
}
infoRegistry.put("fieldCache", new SolrFieldCacheMBean());
@@ -923,7 +923,7 @@ public final class SolrCore implements S
* Load the request processors
*/
private Map<String,UpdateRequestProcessorChain> loadUpdateProcessorChains() {
- Map<String, UpdateRequestProcessorChain> map = new HashMap<String, UpdateRequestProcessorChain>();
+ Map<String, UpdateRequestProcessorChain> map = new HashMap<>();
UpdateRequestProcessorChain def = initPlugins(map,UpdateRequestProcessorChain.class, UpdateRequestProcessorChain.class.getName());
if(def == null){
def = map.get(null);
@@ -1141,7 +1141,7 @@ public final class SolrCore implements S
public void addCloseHook( CloseHook hook )
{
if( closeHooks == null ) {
- closeHooks = new ArrayList<CloseHook>();
+ closeHooks = new ArrayList<>();
}
closeHooks.add( hook );
}
@@ -1218,7 +1218,7 @@ public final class SolrCore implements S
*/
private Map<String, SearchComponent> loadSearchComponents()
{
- Map<String, SearchComponent> components = new HashMap<String, SearchComponent>();
+ Map<String, SearchComponent> components = new HashMap<>();
initPlugins(components,SearchComponent.class);
for (Map.Entry<String, SearchComponent> e : components.entrySet()) {
SearchComponent c = e.getValue();
@@ -1303,8 +1303,8 @@ public final class SolrCore implements S
// All of the normal open searchers. Don't access this directly.
// protected by synchronizing on searcherLock.
- private final LinkedList<RefCounted<SolrIndexSearcher>> _searchers = new LinkedList<RefCounted<SolrIndexSearcher>>();
- private final LinkedList<RefCounted<SolrIndexSearcher>> _realtimeSearchers = new LinkedList<RefCounted<SolrIndexSearcher>>();
+ private final LinkedList<RefCounted<SolrIndexSearcher>> _searchers = new LinkedList<>();
+ private final LinkedList<RefCounted<SolrIndexSearcher>> _realtimeSearchers = new LinkedList<>();
final ExecutorService searcherExecutor = Executors.newSingleThreadExecutor(
new DefaultSolrThreadFactory("searcherExecutor"));
@@ -1940,7 +1940,7 @@ public final class SolrCore implements S
public static void preDecorateResponse(SolrQueryRequest req, SolrQueryResponse rsp) {
// setup response header
- final NamedList<Object> responseHeader = new SimpleOrderedMap<Object>();
+ final NamedList<Object> responseHeader = new SimpleOrderedMap<>();
rsp.add("responseHeader", responseHeader);
// toLog is a local ref to the same NamedList used by the response
@@ -2010,10 +2010,10 @@ public final class SolrCore implements S
private QueryResponseWriter defaultResponseWriter;
- private final Map<String, QueryResponseWriter> responseWriters = new HashMap<String, QueryResponseWriter>();
+ private final Map<String, QueryResponseWriter> responseWriters = new HashMap<>();
public static final Map<String ,QueryResponseWriter> DEFAULT_RESPONSE_WRITERS ;
static{
- HashMap<String, QueryResponseWriter> m= new HashMap<String, QueryResponseWriter>();
+ HashMap<String, QueryResponseWriter> m= new HashMap<>();
m.put("xml", new XMLResponseWriter());
m.put("standard", m.get("xml"));
m.put("json", new JSONResponseWriter());
@@ -2032,7 +2032,7 @@ public final class SolrCore implements S
* writers may also be configured. */
private void initWriters() {
// use link map so we iterate in the same order
- Map<PluginInfo,QueryResponseWriter> writers = new LinkedHashMap<PluginInfo,QueryResponseWriter>();
+ Map<PluginInfo,QueryResponseWriter> writers = new LinkedHashMap<>();
for (PluginInfo info : solrConfig.getPluginInfos(QueryResponseWriter.class.getName())) {
try {
QueryResponseWriter writer;
@@ -2112,7 +2112,7 @@ public final class SolrCore implements S
return getQueryResponseWriter(request.getParams().get(CommonParams.WT));
}
- private final Map<String, QParserPlugin> qParserPlugins = new HashMap<String, QParserPlugin>();
+ private final Map<String, QParserPlugin> qParserPlugins = new HashMap<>();
/** Configure the query parsers. */
private void initQParsers() {
@@ -2140,7 +2140,7 @@ public final class SolrCore implements S
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "Unknown query parser '"+parserName+"'");
}
- private final HashMap<String, ValueSourceParser> valueSourceParsers = new HashMap<String, ValueSourceParser>();
+ private final HashMap<String, ValueSourceParser> valueSourceParsers = new HashMap<>();
/** Configure the ValueSource (function) plugins */
private void initValueSourceParsers() {
@@ -2161,7 +2161,7 @@ public final class SolrCore implements S
}
- private final HashMap<String, TransformerFactory> transformerFactories = new HashMap<String, TransformerFactory>();
+ private final HashMap<String, TransformerFactory> transformerFactories = new HashMap<>();
/** Configure the TransformerFactory plugins */
private void initTransformerFactories() {
@@ -2220,7 +2220,7 @@ public final class SolrCore implements S
*/
public <T> List<T> initPlugins(List<PluginInfo> pluginInfos, Class<T> type, String defClassName) {
if(pluginInfos.isEmpty()) return Collections.emptyList();
- List<T> result = new ArrayList<T>();
+ List<T> result = new ArrayList<>();
for (PluginInfo info : pluginInfos) result.add(createInitInstance(info,type, type.getSimpleName(), defClassName));
return result;
}
@@ -2251,10 +2251,10 @@ public final class SolrCore implements S
"solrconfig.xml uses deprecated <admin/gettableFiles>, Please "+
"update your config to use the ShowFileRequestHandler." );
if( getRequestHandler( "/admin/file" ) == null ) {
- NamedList<String> invariants = new NamedList<String>();
+ NamedList<String> invariants = new NamedList<>();
// Hide everything...
- Set<String> hide = new HashSet<String>();
+ Set<String> hide = new HashSet<>();
for (String file : solrConfig.getResourceLoader().listConfigDir()) {
hide.add(file.toUpperCase(Locale.ROOT));
@@ -2269,7 +2269,7 @@ public final class SolrCore implements S
invariants.add( ShowFileRequestHandler.HIDDEN, s );
}
- NamedList<Object> args = new NamedList<Object>();
+ NamedList<Object> args = new NamedList<>();
args.add( "invariants", invariants );
ShowFileRequestHandler handler = new ShowFileRequestHandler();
handler.init( args );
@@ -2330,7 +2330,7 @@ public final class SolrCore implements S
@Override
public NamedList getStatistics() {
- NamedList<Object> lst = new SimpleOrderedMap<Object>();
+ NamedList<Object> lst = new SimpleOrderedMap<>();
lst.add("coreName", name==null ? "(null)" : name);
lst.add("startTime", new Date(startTime));
lst.add("refCount", getOpenCount());
Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/SolrCores.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/SolrCores.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/SolrCores.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/SolrCores.java Wed Mar 12 14:39:17 2014
@@ -36,16 +36,16 @@ import java.util.concurrent.ConcurrentHa
class SolrCores {
private static Object modifyLock = new Object(); // for locking around manipulating any of the core maps.
- private final Map<String, SolrCore> cores = new LinkedHashMap<String, SolrCore>(); // For "permanent" cores
+ private final Map<String, SolrCore> cores = new LinkedHashMap<>(); // For "permanent" cores
//WARNING! The _only_ place you put anything into the list of transient cores is with the putTransientCore method!
- private Map<String, SolrCore> transientCores = new LinkedHashMap<String, SolrCore>(); // For "lazily loaded" cores
+ private Map<String, SolrCore> transientCores = new LinkedHashMap<>(); // For "lazily loaded" cores
- private final Map<String, CoreDescriptor> dynamicDescriptors = new LinkedHashMap<String, CoreDescriptor>();
+ private final Map<String, CoreDescriptor> dynamicDescriptors = new LinkedHashMap<>();
- private final Map<String, SolrCore> createdCores = new LinkedHashMap<String, SolrCore>();
+ private final Map<String, SolrCore> createdCores = new LinkedHashMap<>();
- private Map<SolrCore, String> coreToOrigName = new ConcurrentHashMap<SolrCore, String>();
+ private Map<SolrCore, String> coreToOrigName = new ConcurrentHashMap<>();
private final CoreContainer container;
@@ -53,11 +53,11 @@ class SolrCores {
// This map will hold objects that are being currently operated on. The core (value) may be null in the case of
// initial load. The rule is, never to any operation on a core that is currently being operated upon.
- private static final Set<String> pendingCoreOps = new HashSet<String>();
+ private static final Set<String> pendingCoreOps = new HashSet<>();
// Due to the fact that closes happen potentially whenever anything is _added_ to the transient core list, we need
// to essentially queue them up to be handled via pendingCoreOps.
- private static final List<SolrCore> pendingCloses = new ArrayList<SolrCore>();
+ private static final List<SolrCore> pendingCloses = new ArrayList<>();
SolrCores(CoreContainer container) {
this.container = container;
@@ -95,7 +95,7 @@ class SolrCores {
// We are shutting down. You can't hold the lock on the various lists of cores while they shut down, so we need to
// make a temporary copy of the names and shut them down outside the lock.
protected void close() {
- Collection<SolrCore> coreList = new ArrayList<SolrCore>();
+ Collection<SolrCore> coreList = new ArrayList<>();
// It might be possible for one of the cores to move from one list to another while we're closing them. So
// loop through the lists until they're all empty. In particular, the core could have moved from the transient
@@ -145,7 +145,7 @@ class SolrCores {
}
List<SolrCore> getCores() {
- List<SolrCore> lst = new ArrayList<SolrCore>();
+ List<SolrCore> lst = new ArrayList<>();
synchronized (modifyLock) {
lst.addAll(cores.values());
@@ -154,7 +154,7 @@ class SolrCores {
}
Set<String> getCoreNames() {
- Set<String> set = new TreeSet<String>();
+ Set<String> set = new TreeSet<>();
synchronized (modifyLock) {
set.addAll(cores.keySet());
@@ -164,7 +164,7 @@ class SolrCores {
}
List<String> getCoreNames(SolrCore core) {
- List<String> lst = new ArrayList<String>();
+ List<String> lst = new ArrayList<>();
synchronized (modifyLock) {
for (Map.Entry<String, SolrCore> entry : cores.entrySet()) {
@@ -187,7 +187,7 @@ class SolrCores {
* @return all cores names, whether loaded or unloaded.
*/
public Collection<String> getAllCoreNames() {
- Set<String> set = new TreeSet<String>();
+ Set<String> set = new TreeSet<>();
synchronized (modifyLock) {
set.addAll(cores.keySet());
set.addAll(transientCores.keySet());
Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/SolrResourceLoader.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/SolrResourceLoader.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/SolrResourceLoader.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/SolrResourceLoader.java Wed Mar 12 14:39:17 2014
@@ -390,7 +390,7 @@ public class SolrResourceLoader implemen
/*
* A static map of short class name to fully qualified class name
*/
- private static final Map<String, String> classNameCache = new ConcurrentHashMap<String, String>();
+ private static final Map<String, String> classNameCache = new ConcurrentHashMap<>();
// Using this pattern, legacy analysis components from previous Solr versions are identified and delegated to SPI loader:
private static final Pattern legacyAnalysisPattern =
@@ -742,7 +742,7 @@ public class SolrResourceLoader implemen
*/
private static final Map<Class, Class[]> awareCompatibility;
static {
- awareCompatibility = new HashMap<Class, Class[]>();
+ awareCompatibility = new HashMap<>();
awareCompatibility.put(
SolrCoreAware.class, new Class[] {
CodecFactory.class,
Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/SolrXMLCoresLocator.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/SolrXMLCoresLocator.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/SolrXMLCoresLocator.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/SolrXMLCoresLocator.java Wed Mar 12 14:39:17 2014
@@ -143,7 +143,7 @@ public class SolrXMLCoresLocator impleme
@Override
public synchronized final void persist(CoreContainer cc, CoreDescriptor... coreDescriptors) {
- List<CoreDescriptor> cds = new ArrayList<CoreDescriptor>(cc.getCoreDescriptors().size() + coreDescriptors.length);
+ List<CoreDescriptor> cds = new ArrayList<>(cc.getCoreDescriptors().size() + coreDescriptors.length);
cds.addAll(cc.getCoreDescriptors());
cds.addAll(Arrays.asList(coreDescriptors));
Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/ZkContainer.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/ZkContainer.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/ZkContainer.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/ZkContainer.java Wed Mar 12 14:39:17 2014
@@ -141,7 +141,7 @@ public class ZkContainer {
@Override
public List<CoreDescriptor> getCurrentDescriptors() {
- List<CoreDescriptor> descriptors = new ArrayList<CoreDescriptor>(
+ List<CoreDescriptor> descriptors = new ArrayList<>(
cc.getCoreNames().size());
Collection<SolrCore> cores = cc.getCores();
for (SolrCore core : cores) {
Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/AnalysisRequestHandlerBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/AnalysisRequestHandlerBase.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/AnalysisRequestHandlerBase.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/AnalysisRequestHandlerBase.java Wed Mar 12 14:39:17 2014
@@ -87,7 +87,7 @@ public abstract class AnalysisRequestHan
if (!TokenizerChain.class.isInstance(analyzer)) {
try (TokenStream tokenStream = analyzer.tokenStream(context.getFieldName(), value)) {
- NamedList<List<NamedList>> namedList = new NamedList<List<NamedList>>();
+ NamedList<List<NamedList>> namedList = new NamedList<>();
namedList.add(tokenStream.getClass().getName(), convertTokensToNamedLists(analyzeTokenStream(tokenStream), context));
return namedList;
} catch (IOException e) {
@@ -100,7 +100,7 @@ public abstract class AnalysisRequestHan
TokenizerFactory tfac = tokenizerChain.getTokenizerFactory();
TokenFilterFactory[] filtfacs = tokenizerChain.getTokenFilterFactories();
- NamedList<Object> namedList = new NamedList<Object>();
+ NamedList<Object> namedList = new NamedList<>();
if( cfiltfacs != null ){
String source = value;
@@ -144,7 +144,7 @@ public abstract class AnalysisRequestHan
*/
protected Set<BytesRef> getQueryTokenSet(String query, Analyzer analyzer) {
try (TokenStream tokenStream = analyzer.tokenStream("", query)){
- final Set<BytesRef> tokens = new HashSet<BytesRef>();
+ final Set<BytesRef> tokens = new HashSet<>();
final TermToBytesRefAttribute bytesAtt = tokenStream.getAttribute(TermToBytesRefAttribute.class);
final BytesRef bytes = bytesAtt.getBytesRef();
@@ -170,7 +170,7 @@ public abstract class AnalysisRequestHan
* @return List of tokens produced from the TokenStream
*/
private List<AttributeSource> analyzeTokenStream(TokenStream tokenStream) {
- final List<AttributeSource> tokens = new ArrayList<AttributeSource>();
+ final List<AttributeSource> tokens = new ArrayList<>();
final PositionIncrementAttribute posIncrAtt = tokenStream.addAttribute(PositionIncrementAttribute.class);
final TokenTrackingAttribute trackerAtt = tokenStream.addAttribute(TokenTrackingAttribute.class);
// for backwards compatibility, add all "common" attributes
@@ -212,7 +212,7 @@ public abstract class AnalysisRequestHan
* @return List of NamedLists containing the relevant information taken from the tokens
*/
private List<NamedList> convertTokensToNamedLists(final List<AttributeSource> tokenList, AnalysisContext context) {
- final List<NamedList> tokensNamedLists = new ArrayList<NamedList>();
+ final List<NamedList> tokensNamedLists = new ArrayList<>();
final FieldType fieldType = context.getFieldType();
final AttributeSource[] tokens = tokenList.toArray(new AttributeSource[tokenList.size()]);
@@ -241,7 +241,7 @@ public abstract class AnalysisRequestHan
for (int i = 0; i < tokens.length; i++) {
AttributeSource token = tokens[i];
- final NamedList<Object> tokenNamedList = new SimpleOrderedMap<Object>();
+ final NamedList<Object> tokenNamedList = new SimpleOrderedMap<>();
final TermToBytesRefAttribute termAtt = token.getAttribute(TermToBytesRefAttribute.class);
BytesRef rawBytes = termAtt.getBytesRef();
termAtt.fillBytesRef();