You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2014/03/16 20:39:37 UTC
svn commit: r1578144 [35/37] - in /lucene/dev/branches/lucene5376_2: ./
dev-tools/ dev-tools/idea/.idea/libraries/
dev-tools/idea/solr/contrib/dataimporthandler/
dev-tools/idea/solr/contrib/map-reduce/ dev-tools/idea/solr/core/src/test/
dev-tools/scrip...
Modified: lucene/dev/branches/lucene5376_2/solr/core/src/test/org/apache/solr/update/TestDocBasedVersionConstraints.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5376_2/solr/core/src/test/org/apache/solr/update/TestDocBasedVersionConstraints.java?rev=1578144&r1=1578143&r2=1578144&view=diff
==============================================================================
--- lucene/dev/branches/lucene5376_2/solr/core/src/test/org/apache/solr/update/TestDocBasedVersionConstraints.java (original)
+++ lucene/dev/branches/lucene5376_2/solr/core/src/test/org/apache/solr/update/TestDocBasedVersionConstraints.java Sun Mar 16 19:39:10 2014
@@ -367,7 +367,7 @@ public class TestDocBasedVersionConstrai
final int winner = TestUtil.nextInt(random(), 0, numAdds - 1);
final int winnerVersion = atLeast(100);
final boolean winnerIsDeleted = (0 == TestUtil.nextInt(random(), 0, 4));
- List<Callable<Object>> tasks = new ArrayList<Callable<Object>>(numAdds);
+ List<Callable<Object>> tasks = new ArrayList<>(numAdds);
for (int variant = 0; variant < numAdds; variant++) {
final boolean iShouldWin = (variant==winner);
final long version = (iShouldWin ? winnerVersion
Modified: lucene/dev/branches/lucene5376_2/solr/core/src/test/org/apache/solr/update/processor/FieldMutatingUpdateProcessorTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5376_2/solr/core/src/test/org/apache/solr/update/processor/FieldMutatingUpdateProcessorTest.java?rev=1578144&r1=1578143&r2=1578144&view=diff
==============================================================================
--- lucene/dev/branches/lucene5376_2/solr/core/src/test/org/apache/solr/update/processor/FieldMutatingUpdateProcessorTest.java (original)
+++ lucene/dev/branches/lucene5376_2/solr/core/src/test/org/apache/solr/update/processor/FieldMutatingUpdateProcessorTest.java Sun Mar 16 19:39:10 2014
@@ -415,7 +415,7 @@ public class FieldMutatingUpdateProcesso
// test something that's definitely a SortedSet
special = new SolrInputField("foo_s");
- special.setValue(new TreeSet<String>
+ special.setValue(new TreeSet<>
(Arrays.asList("ggg", "first", "last", "hhh")), 1.2F);
d = processAdd("last-value",
@@ -443,7 +443,7 @@ public class FieldMutatingUpdateProcesso
// (ie: get default behavior of Collection using iterator)
special = new SolrInputField("foo_s");
- special.setValue(new LinkedHashSet<String>
+ special.setValue(new LinkedHashSet<>
(Arrays.asList("first", "ggg", "hhh", "last")), 1.2F);
d = processAdd("last-value",
Modified: lucene/dev/branches/lucene5376_2/solr/core/src/test/org/apache/solr/update/processor/ParsingFieldUpdateProcessorsTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5376_2/solr/core/src/test/org/apache/solr/update/processor/ParsingFieldUpdateProcessorsTest.java?rev=1578144&r1=1578143&r2=1578144&view=diff
==============================================================================
--- lucene/dev/branches/lucene5376_2/solr/core/src/test/org/apache/solr/update/processor/ParsingFieldUpdateProcessorsTest.java (original)
+++ lucene/dev/branches/lucene5376_2/solr/core/src/test/org/apache/solr/update/processor/ParsingFieldUpdateProcessorsTest.java Sun Mar 16 19:39:10 2014
@@ -240,7 +240,7 @@ public class ParsingFieldUpdateProcessor
IndexSchema schema = h.getCore().getLatestSchema();
assertNull(schema.getFieldOrNull("not_in_schema"));
DateTimeFormatter dateTimeFormatter = ISODateTimeFormat.dateOptionalTimeParser().withZoneUTC();
- Map<Object,Object> mixed = new HashMap<Object,Object>();
+ Map<Object,Object> mixed = new HashMap<>();
String[] dateStrings = { "2020-05-13T18:47", "1989-12-14", "1682-07-22T18:33:00.000Z" };
for (String dateString : dateStrings) {
mixed.put(dateTimeFormatter.parseDateTime(dateString).toDate(), dateString);
@@ -339,7 +339,7 @@ public class ParsingFieldUpdateProcessor
public void testFailedParseMixedInt() throws Exception {
IndexSchema schema = h.getCore().getLatestSchema();
assertNull(schema.getFieldOrNull("not_in_schema"));
- Map<Object,Object> mixed = new HashMap<Object,Object>();
+ Map<Object,Object> mixed = new HashMap<>();
Float floatVal = 294423.0f;
mixed.put(85, "85");
mixed.put(floatVal, floatVal); // Float-typed field value
@@ -422,7 +422,7 @@ public class ParsingFieldUpdateProcessor
public void testFailedParseMixedLong() throws Exception {
IndexSchema schema = h.getCore().getLatestSchema();
assertNull(schema.getFieldOrNull("not_in_schema"));
- Map<Object,Object> mixed = new HashMap<Object,Object>();
+ Map<Object,Object> mixed = new HashMap<>();
Float floatVal = 294423.0f;
mixed.put(85L, "85");
mixed.put(floatVal, floatVal); // Float-typed field value
@@ -506,7 +506,7 @@ public class ParsingFieldUpdateProcessor
public void testMixedFloats() throws Exception {
IndexSchema schema = h.getCore().getLatestSchema();
assertNotNull(schema.getFieldOrNull("float_tf")); // should match dynamic field "*_tf"
- Map<Float,Object> mixedFloats = new HashMap<Float,Object>();
+ Map<Float,Object> mixedFloats = new HashMap<>();
mixedFloats.put(85.0f, "85");
mixedFloats.put(2894518.0f, "2,894,518");
mixedFloats.put(2.94423E-9f, 2.94423E-9f); // Float-typed field value
@@ -524,7 +524,7 @@ public class ParsingFieldUpdateProcessor
public void testFailedParseMixedFloat() throws Exception {
IndexSchema schema = h.getCore().getLatestSchema();
assertNull(schema.getFieldOrNull("not_in_schema"));
- Map<Object,Object> mixed = new HashMap<Object,Object>();
+ Map<Object,Object> mixed = new HashMap<>();
Long longVal = 294423L;
mixed.put(85L, "85");
mixed.put(longVal, longVal); // Float-typed field value
@@ -608,7 +608,7 @@ public class ParsingFieldUpdateProcessor
public void testFailedParseMixedDouble() throws Exception {
IndexSchema schema = h.getCore().getLatestSchema();
assertNull(schema.getFieldOrNull("not_in_schema"));
- Map<Object,Object> mixed = new HashMap<Object,Object>();
+ Map<Object,Object> mixed = new HashMap<>();
Long longVal = 294423L;
mixed.put(85, "85.0");
mixed.put(longVal, longVal); // Float-typed field value
@@ -710,7 +710,7 @@ public class ParsingFieldUpdateProcessor
public void testFailedParseMixedBoolean() throws Exception {
IndexSchema schema = h.getCore().getLatestSchema();
assertNull(schema.getFieldOrNull("not_in_schema"));
- Map<Object,Object> mixed = new HashMap<Object,Object>();
+ Map<Object,Object> mixed = new HashMap<>();
Long longVal = 294423L;
mixed.put(true, "true");
mixed.put(longVal, longVal); // Float-typed field value
@@ -739,7 +739,7 @@ public class ParsingFieldUpdateProcessor
SolrInputDocument d = null;
String chain = "cascading-parsers-no-run-processor";
- Map<Boolean,String> booleans = new HashMap<Boolean,String>();
+ Map<Boolean,String> booleans = new HashMap<>();
booleans.put(true, "truE");
booleans.put(false, "False");
d = processAdd(chain, doc(f("id", "341"), f(fieldName, booleans.values())));
@@ -750,7 +750,7 @@ public class ParsingFieldUpdateProcessor
}
assertTrue(booleans.isEmpty());
- Map<Integer,String> ints = new HashMap<Integer,String>();
+ Map<Integer,String> ints = new HashMap<>();
ints.put(2, "2");
ints.put(50928, "50928");
ints.put(86942008, "86,942,008");
@@ -762,7 +762,7 @@ public class ParsingFieldUpdateProcessor
}
assertTrue(ints.isEmpty());
- Map<Long,String> longs = new HashMap<Long,String>();
+ Map<Long,String> longs = new HashMap<>();
longs.put(2L, "2");
longs.put(50928L, "50928");
longs.put(86942008987654L, "86,942,008,987,654");
@@ -789,7 +789,7 @@ public class ParsingFieldUpdateProcessor
}
*/
- Map<Double,String> doubles = new HashMap<Double,String>();
+ Map<Double,String> doubles = new HashMap<>();
doubles.put(2.0, "2.");
doubles.put(509.28, "509.28");
doubles.put(86942.008, "86,942.008");
@@ -801,7 +801,7 @@ public class ParsingFieldUpdateProcessor
}
DateTimeFormatter dateTimeFormatter = ISODateTimeFormat.dateOptionalTimeParser().withZoneUTC();
- Map<Date,String> dates = new HashMap<Date,String>();
+ Map<Date,String> dates = new HashMap<>();
String[] dateStrings = { "2020-05-13T18:47", "1989-12-14", "1682-07-22T18:33:00.000Z" };
for (String dateString : dateStrings) {
dates.put(dateTimeFormatter.parseDateTime(dateString).toDate(), dateString);
@@ -814,7 +814,7 @@ public class ParsingFieldUpdateProcessor
}
assertTrue(dates.isEmpty());
- Map<Double,String> mixedLongsAndDoubles = new LinkedHashMap<Double,String>(); // preserve order
+ Map<Double,String> mixedLongsAndDoubles = new LinkedHashMap<>(); // preserve order
mixedLongsAndDoubles.put(85.0, "85");
mixedLongsAndDoubles.put(2.94423E-9, "2.94423E-9");
mixedLongsAndDoubles.put(2894518.0, "2,894,518");
@@ -827,7 +827,7 @@ public class ParsingFieldUpdateProcessor
}
assertTrue(mixedLongsAndDoubles.isEmpty());
- Set<String> mixed = new HashSet<String>();
+ Set<String> mixed = new HashSet<>();
mixed.add("true");
mixed.add("1682-07-22T18:33:00.000Z");
mixed.add("2,894,518");
@@ -839,7 +839,7 @@ public class ParsingFieldUpdateProcessor
assertTrue(o instanceof String);
}
- Map<Double,Object> mixedDoubles = new LinkedHashMap<Double,Object>(); // preserve order
+ Map<Double,Object> mixedDoubles = new LinkedHashMap<>(); // preserve order
mixedDoubles.put(85.0, "85");
mixedDoubles.put(2.94423E-9, 2.94423E-9); // Double-typed field value
mixedDoubles.put(2894518.0, "2,894,518");
@@ -852,7 +852,7 @@ public class ParsingFieldUpdateProcessor
}
assertTrue(mixedDoubles.isEmpty());
- Map<Integer,Object> mixedInts = new LinkedHashMap<Integer,Object>(); // preserve order
+ Map<Integer,Object> mixedInts = new LinkedHashMap<>(); // preserve order
mixedInts.put(85, "85");
mixedInts.put(294423, 294423); // Integer-typed field value
mixedInts.put(-2894518, "-2,894,518");
@@ -865,7 +865,7 @@ public class ParsingFieldUpdateProcessor
}
assertTrue(mixedInts.isEmpty());
- Map<Long,Object> mixedLongs = new LinkedHashMap<Long,Object>(); // preserve order
+ Map<Long,Object> mixedLongs = new LinkedHashMap<>(); // preserve order
mixedLongs.put(85L, "85");
mixedLongs.put(42944233L, 42944233L); // Long-typed field value
mixedLongs.put(2894518L, "2,894,518");
@@ -878,7 +878,7 @@ public class ParsingFieldUpdateProcessor
}
assertTrue(mixedLongs.isEmpty());
- Map<Boolean,Object> mixedBooleans = new LinkedHashMap<Boolean,Object>(); // preserve order
+ Map<Boolean,Object> mixedBooleans = new LinkedHashMap<>(); // preserve order
mixedBooleans.put(true, "true");
mixedBooleans.put(false, false); // Boolean-typed field value
mixedBooleans.put(false, "false");
@@ -892,7 +892,7 @@ public class ParsingFieldUpdateProcessor
assertTrue(mixedBooleans.isEmpty());
dateTimeFormatter = ISODateTimeFormat.dateOptionalTimeParser().withZoneUTC();
- Map<Date,Object> mixedDates = new HashMap<Date,Object>();
+ Map<Date,Object> mixedDates = new HashMap<>();
dateStrings = new String[] { "2020-05-13T18:47", "1989-12-14", "1682-07-22T18:33:00.000Z" };
for (String dateString : dateStrings) {
mixedDates.put(dateTimeFormatter.parseDateTime(dateString).toDate(), dateString);
Modified: lucene/dev/branches/lucene5376_2/solr/core/src/test/org/apache/solr/update/processor/SignatureUpdateProcessorFactoryTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5376_2/solr/core/src/test/org/apache/solr/update/processor/SignatureUpdateProcessorFactoryTest.java?rev=1578144&r1=1578143&r2=1578144&view=diff
==============================================================================
--- lucene/dev/branches/lucene5376_2/solr/core/src/test/org/apache/solr/update/processor/SignatureUpdateProcessorFactoryTest.java (original)
+++ lucene/dev/branches/lucene5376_2/solr/core/src/test/org/apache/solr/update/processor/SignatureUpdateProcessorFactoryTest.java Sun Mar 16 19:39:10 2014
@@ -21,6 +21,8 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
+import org.apache.lucene.util.Constants;
+
import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.client.solrj.impl.BinaryRequestWriter;
import org.apache.solr.client.solrj.request.UpdateRequest;
@@ -49,8 +51,8 @@ public class SignatureUpdateProcessorFac
@BeforeClass
public static void betterNotBeJ9() {
- assumeFalse("FIXME: SOLR-5793: This test fails under J9",
- System.getProperty("java.vm.info", "<?>").contains("IBM J9"));
+ assumeFalse("FIXME: SOLR-5793: This test fails under IBM J9",
+ Constants.JAVA_VENDOR.startsWith("IBM"));
}
@@ -251,7 +253,7 @@ public class SignatureUpdateProcessorFac
public void testFailNonIndexedSigWithOverwriteDupes() throws Exception {
SolrCore core = h.getCore();
SignatureUpdateProcessorFactory f = new SignatureUpdateProcessorFactory();
- NamedList<String> initArgs = new NamedList<String>();
+ NamedList<String> initArgs = new NamedList<>();
initArgs.add("overwriteDupes", "true");
initArgs.add("signatureField", "signatureField_sS");
f.init(initArgs);
@@ -276,7 +278,7 @@ public class SignatureUpdateProcessorFac
.getFactories()[0]);
factory.setEnabled(true);
- Map<String,String[]> params = new HashMap<String,String[]>();
+ Map<String,String[]> params = new HashMap<>();
MultiMapSolrParams mmparams = new MultiMapSolrParams(params);
params.put(UpdateParams.UPDATE_CHAIN, new String[] {chain});
@@ -305,7 +307,7 @@ public class SignatureUpdateProcessorFac
SolrInputDocument docA = new SolrInputDocument();
SolrInputDocument docB = new SolrInputDocument();
- UnusualList<Integer> ints = new UnusualList<Integer>(3);
+ UnusualList<Integer> ints = new UnusualList<>(3);
for (int val : new int[] {42, 66, 34}) {
docA.addField("ints_is", new Integer(val));
ints.add(val);
@@ -331,7 +333,7 @@ public class SignatureUpdateProcessorFac
}
- ArrayList<ContentStream> streams = new ArrayList<ContentStream>(2);
+ ArrayList<ContentStream> streams = new ArrayList<>(2);
streams.add(new BinaryRequestWriter().getContentStream(ureq));
LocalSolrQueryRequest req = new LocalSolrQueryRequest(h.getCore(), mmparams);
try {
@@ -366,7 +368,7 @@ public class SignatureUpdateProcessorFac
}
static void addDoc(String doc, String chain) throws Exception {
- Map<String, String[]> params = new HashMap<String, String[]>();
+ Map<String, String[]> params = new HashMap<>();
MultiMapSolrParams mmparams = new MultiMapSolrParams(params);
params.put(UpdateParams.UPDATE_CHAIN, new String[] { chain });
SolrQueryRequestBase req = new SolrQueryRequestBase(h.getCore(),
@@ -375,7 +377,7 @@ public class SignatureUpdateProcessorFac
UpdateRequestHandler handler = new UpdateRequestHandler();
handler.init(null);
- ArrayList<ContentStream> streams = new ArrayList<ContentStream>(2);
+ ArrayList<ContentStream> streams = new ArrayList<>(2);
streams.add(new ContentStreamBase.StringStream(doc));
req.setContentStreams(streams);
handler.handleRequestBody(req, new SolrQueryResponse());
Modified: lucene/dev/branches/lucene5376_2/solr/core/src/test/org/apache/solr/update/processor/StatelessScriptUpdateProcessorFactoryTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5376_2/solr/core/src/test/org/apache/solr/update/processor/StatelessScriptUpdateProcessorFactoryTest.java?rev=1578144&r1=1578143&r2=1578144&view=diff
==============================================================================
--- lucene/dev/branches/lucene5376_2/solr/core/src/test/org/apache/solr/update/processor/StatelessScriptUpdateProcessorFactoryTest.java (original)
+++ lucene/dev/branches/lucene5376_2/solr/core/src/test/org/apache/solr/update/processor/StatelessScriptUpdateProcessorFactoryTest.java Sun Mar 16 19:39:10 2014
@@ -77,7 +77,7 @@ public class StatelessScriptUpdateProces
SolrCore core = h.getCore();
UpdateRequestProcessorChain chained = core.getUpdateProcessingChain("single-script");
final StatelessScriptUpdateProcessorFactory factory = ((StatelessScriptUpdateProcessorFactory) chained.getFactories()[0]);
- final List<String> functionMessages = new ArrayList<String>();
+ final List<String> functionMessages = new ArrayList<>();
factory.setScriptEngineCustomizer(new ScriptEngineCustomizer() {
@Override
public void customize(ScriptEngine engine) {
@@ -122,7 +122,7 @@ public class StatelessScriptUpdateProces
UpdateRequestProcessorChain chained = core.getUpdateProcessingChain(chain);
final StatelessScriptUpdateProcessorFactory factory =
((StatelessScriptUpdateProcessorFactory) chained.getFactories()[0]);
- final List<String> functionMessages = new ArrayList<String>();
+ final List<String> functionMessages = new ArrayList<>();
ScriptEngineCustomizer customizer = new ScriptEngineCustomizer() {
@Override
public void customize(ScriptEngine engine) {
Modified: lucene/dev/branches/lucene5376_2/solr/core/src/test/org/apache/solr/update/processor/UniqFieldsUpdateProcessorFactoryTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5376_2/solr/core/src/test/org/apache/solr/update/processor/UniqFieldsUpdateProcessorFactoryTest.java?rev=1578144&r1=1578143&r2=1578144&view=diff
==============================================================================
--- lucene/dev/branches/lucene5376_2/solr/core/src/test/org/apache/solr/update/processor/UniqFieldsUpdateProcessorFactoryTest.java (original)
+++ lucene/dev/branches/lucene5376_2/solr/core/src/test/org/apache/solr/update/processor/UniqFieldsUpdateProcessorFactoryTest.java Sun Mar 16 19:39:10 2014
@@ -106,7 +106,7 @@ public class UniqFieldsUpdateProcessorFa
}
private void addDoc(String doc) throws Exception {
- Map<String, String[]> params = new HashMap<String, String[]>();
+ Map<String, String[]> params = new HashMap<>();
MultiMapSolrParams mmparams = new MultiMapSolrParams(params);
params.put(UpdateParams.UPDATE_CHAIN, new String[] { "uniq-fields" });
SolrQueryRequestBase req = new SolrQueryRequestBase(h.getCore(),
@@ -115,7 +115,7 @@ public class UniqFieldsUpdateProcessorFa
UpdateRequestHandler handler = new UpdateRequestHandler();
handler.init(null);
- ArrayList<ContentStream> streams = new ArrayList<ContentStream>(2);
+ ArrayList<ContentStream> streams = new ArrayList<>(2);
streams.add(new ContentStreamBase.StringStream(doc));
req.setContentStreams(streams);
handler.handleRequestBody(req, new SolrQueryResponse());
Modified: lucene/dev/branches/lucene5376_2/solr/core/src/test/org/apache/solr/util/CircularListTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5376_2/solr/core/src/test/org/apache/solr/util/CircularListTest.java?rev=1578144&r1=1578143&r2=1578144&view=diff
==============================================================================
--- lucene/dev/branches/lucene5376_2/solr/core/src/test/org/apache/solr/util/CircularListTest.java (original)
+++ lucene/dev/branches/lucene5376_2/solr/core/src/test/org/apache/solr/util/CircularListTest.java Sun Mar 16 19:39:10 2014
@@ -30,7 +30,7 @@ public class CircularListTest extends L
@Test
public void testCircularList() throws IOException {
- CircularList<Integer> list = new CircularList<Integer>(10);
+ CircularList<Integer> list = new CircularList<>(10);
for(int i=0;i<10; i++) {
list.add(new Integer(i));
}
Modified: lucene/dev/branches/lucene5376_2/solr/core/src/test/org/apache/solr/util/DOMUtilTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5376_2/solr/core/src/test/org/apache/solr/util/DOMUtilTest.java?rev=1578144&r1=1578143&r2=1578144&view=diff
==============================================================================
--- lucene/dev/branches/lucene5376_2/solr/core/src/test/org/apache/solr/util/DOMUtilTest.java (original)
+++ lucene/dev/branches/lucene5376_2/solr/core/src/test/org/apache/solr/util/DOMUtilTest.java Sun Mar 16 19:39:10 2014
@@ -23,7 +23,7 @@ import org.apache.solr.common.util.Simpl
public class DOMUtilTest extends DOMUtilTestBase {
public void testAddToNamedListPrimitiveTypes() throws Exception {
- NamedList<Object> namedList = new SimpleOrderedMap<Object>();
+ NamedList<Object> namedList = new SimpleOrderedMap<>();
DOMUtil.addToNamedList( getNode( "<str name=\"String\">STRING</str>", "/str" ), namedList, null );
assertTypeAndValue( namedList, "String", "STRING" );
DOMUtil.addToNamedList( getNode( "<int name=\"Integer\">100</int>", "/int" ), namedList, null );
Modified: lucene/dev/branches/lucene5376_2/solr/core/src/test/org/apache/solr/util/DateMathParserTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5376_2/solr/core/src/test/org/apache/solr/util/DateMathParserTest.java?rev=1578144&r1=1578143&r2=1578144&view=diff
==============================================================================
--- lucene/dev/branches/lucene5376_2/solr/core/src/test/org/apache/solr/util/DateMathParserTest.java (original)
+++ lucene/dev/branches/lucene5376_2/solr/core/src/test/org/apache/solr/util/DateMathParserTest.java Sun Mar 16 19:39:10 2014
@@ -314,7 +314,7 @@ public class DateMathParserTest extends
DateMathParser p = new DateMathParser(UTC, Locale.ROOT);
p.setNow(parser.parse("2001-07-04T12:08:56.235"));
- Map<String,Integer> badCommands = new HashMap<String,Integer>();
+ Map<String,Integer> badCommands = new HashMap<>();
badCommands.put("/", 1);
badCommands.put("+", 1);
badCommands.put("-", 1);
Modified: lucene/dev/branches/lucene5376_2/solr/core/src/test/org/apache/solr/util/SimplePostToolTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5376_2/solr/core/src/test/org/apache/solr/util/SimplePostToolTest.java?rev=1578144&r1=1578143&r2=1578144&view=diff
==============================================================================
--- lucene/dev/branches/lucene5376_2/solr/core/src/test/org/apache/solr/util/SimplePostToolTest.java (original)
+++ lucene/dev/branches/lucene5376_2/solr/core/src/test/org/apache/solr/util/SimplePostToolTest.java Sun Mar 16 19:39:10 2014
@@ -177,8 +177,8 @@ public class SimplePostToolTest extends
}
static class MockPageFetcher extends PageFetcher {
- HashMap<String,String> htmlMap = new HashMap<String,String>();
- HashMap<String,Set<URL>> linkMap = new HashMap<String,Set<URL>>();
+ HashMap<String,String> htmlMap = new HashMap<>();
+ HashMap<String,Set<URL>> linkMap = new HashMap<>();
public MockPageFetcher() throws IOException {
(new SimplePostTool()).super();
@@ -190,18 +190,18 @@ public class SimplePostToolTest extends
htmlMap.put("http://[ff01::114]/page2", "<html><body><a href=\"http://[ff01::114]/\"><a href=\"http://[ff01::114]/disallowed\"/></body></html>");
htmlMap.put("http://[ff01::114]/disallowed", "<html><body><a href=\"http://[ff01::114]/\"></body></html>");
- Set<URL> s = new HashSet<URL>();
+ Set<URL> s = new HashSet<>();
s.add(new URL("http://[ff01::114]/page1"));
s.add(new URL("http://[ff01::114]/page2"));
linkMap.put("http://[ff01::114]", s);
linkMap.put("http://[ff01::114]/index.html", s);
- s = new HashSet<URL>();
+ s = new HashSet<>();
s.add(new URL("http://[ff01::114]/page1/foo"));
linkMap.put("http://[ff01::114]/page1", s);
- s = new HashSet<URL>();
+ s = new HashSet<>();
s.add(new URL("http://[ff01::114]/page1/foo/bar"));
linkMap.put("http://[ff01::114]/page1/foo", s);
- s = new HashSet<URL>();
+ s = new HashSet<>();
s.add(new URL("http://[ff01::114]/disallowed"));
linkMap.put("http://[ff01::114]/page2", s);
@@ -237,7 +237,7 @@ public class SimplePostToolTest extends
public Set<URL> getLinksFromWebPage(URL u, InputStream is, String type, URL postUrl) {
Set<URL> s = linkMap.get(SimplePostTool.normalizeUrlEnding(u.toString()));
if(s == null)
- s = new HashSet<URL>();
+ s = new HashSet<>();
return s;
}
}
Modified: lucene/dev/branches/lucene5376_2/solr/core/src/test/org/apache/solr/util/SolrPluginUtilsTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5376_2/solr/core/src/test/org/apache/solr/util/SolrPluginUtilsTest.java?rev=1578144&r1=1578143&r2=1578144&view=diff
==============================================================================
--- lucene/dev/branches/lucene5376_2/solr/core/src/test/org/apache/solr/util/SolrPluginUtilsTest.java (original)
+++ lucene/dev/branches/lucene5376_2/solr/core/src/test/org/apache/solr/util/SolrPluginUtilsTest.java Sun Mar 16 19:39:10 2014
@@ -76,7 +76,7 @@ public class SolrPluginUtilsTest extends
DocList docs = qr.getDocList();
assertEquals("wrong docs size", 3, docs.size());
- Set<String> fields = new HashSet<String>();
+ Set<String> fields = new HashSet<>();
fields.add("val_dynamic");
fields.add("dynamic_val");
fields.add("range_facet_l"); // copied from id
@@ -149,7 +149,7 @@ public class SolrPluginUtilsTest extends
@Test
public void testParseFieldBoosts() throws Exception {
- Map<String,Float> e1 = new HashMap<String,Float>();
+ Map<String,Float> e1 = new HashMap<>();
e1.put("fieldOne",2.3f);
e1.put("fieldTwo",null);
e1.put("fieldThree",-0.4f);
@@ -165,7 +165,7 @@ public class SolrPluginUtilsTest extends
" fieldTwo fieldThree^-0.4 ",
" "}));
- Map<String,Float> e2 = new HashMap<String,Float>();
+ Map<String,Float> e2 = new HashMap<>();
assertEquals("empty e2", e2, SolrPluginUtils.parseFieldBoosts
(""));
assertEquals("spacey e2", e2, SolrPluginUtils.parseFieldBoosts
Modified: lucene/dev/branches/lucene5376_2/solr/core/src/test/org/apache/solr/util/TestFastWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5376_2/solr/core/src/test/org/apache/solr/util/TestFastWriter.java?rev=1578144&r1=1578143&r2=1578144&view=diff
==============================================================================
--- lucene/dev/branches/lucene5376_2/solr/core/src/test/org/apache/solr/util/TestFastWriter.java (original)
+++ lucene/dev/branches/lucene5376_2/solr/core/src/test/org/apache/solr/util/TestFastWriter.java Sun Mar 16 19:39:10 2014
@@ -28,7 +28,7 @@ import java.util.Random;
class MemWriter extends FastWriter {
- public List<char[]> buffers = new LinkedList<char[]>();
+ public List<char[]> buffers = new LinkedList<>();
Random r;
public MemWriter(char[] tempBuffer, Random r) {
Modified: lucene/dev/branches/lucene5376_2/solr/core/src/test/org/apache/solr/util/TestNumberUtils.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5376_2/solr/core/src/test/org/apache/solr/util/TestNumberUtils.java?rev=1578144&r1=1578143&r2=1578144&view=diff
==============================================================================
--- lucene/dev/branches/lucene5376_2/solr/core/src/test/org/apache/solr/util/TestNumberUtils.java (original)
+++ lucene/dev/branches/lucene5376_2/solr/core/src/test/org/apache/solr/util/TestNumberUtils.java Sun Mar 16 19:39:10 2014
@@ -126,7 +126,7 @@ public class TestNumberUtils extends Luc
int iter=1000;
// INTEGERS
- List<Converter> converters = new ArrayList<Converter>();
+ List<Converter> converters = new ArrayList<>();
converters.add( new Int2Int() );
converters.add( new SortInt() );
converters.add( new Base10kS() );
Modified: lucene/dev/branches/lucene5376_2/solr/core/src/test/org/apache/solr/util/TestUtils.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5376_2/solr/core/src/test/org/apache/solr/util/TestUtils.java?rev=1578144&r1=1578143&r2=1578144&view=diff
==============================================================================
--- lucene/dev/branches/lucene5376_2/solr/core/src/test/org/apache/solr/util/TestUtils.java (original)
+++ lucene/dev/branches/lucene5376_2/solr/core/src/test/org/apache/solr/util/TestUtils.java Sun Mar 16 19:39:10 2014
@@ -74,20 +74,20 @@ public class TestUtils extends LuceneTes
public void testNamedLists()
{
- SimpleOrderedMap<Integer> map = new SimpleOrderedMap<Integer>();
+ SimpleOrderedMap<Integer> map = new SimpleOrderedMap<>();
map.add( "test", 10 );
SimpleOrderedMap<Integer> clone = map.clone();
assertEquals( map.toString(), clone.toString() );
assertEquals( new Integer(10), clone.get( "test" ) );
- Map<String,Integer> realMap = new HashMap<String, Integer>();
+ Map<String,Integer> realMap = new HashMap<>();
realMap.put( "one", 1 );
realMap.put( "two", 2 );
realMap.put( "three", 3 );
- map = new SimpleOrderedMap<Integer>();
+ map = new SimpleOrderedMap<>();
map.addAll( realMap );
assertEquals( 3, map.size() );
- map = new SimpleOrderedMap<Integer>();
+ map = new SimpleOrderedMap<>();
map.add( "one", 1 );
map.add( "two", 2 );
map.add( "three", 3 );
@@ -101,7 +101,7 @@ public class TestUtils extends LuceneTes
assertEquals( 4, map.indexOf( null, 1 ) );
assertEquals( null, map.get( null, 1 ) );
- map = new SimpleOrderedMap<Integer>();
+ map = new SimpleOrderedMap<>();
map.add( "one", 1 );
map.add( "two", 2 );
Iterator<Map.Entry<String, Integer>> iter = map.iterator();
Modified: lucene/dev/branches/lucene5376_2/solr/core/src/test/org/apache/solr/util/TimeZoneUtilsTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5376_2/solr/core/src/test/org/apache/solr/util/TimeZoneUtilsTest.java?rev=1578144&r1=1578143&r2=1578144&view=diff
==============================================================================
--- lucene/dev/branches/lucene5376_2/solr/core/src/test/org/apache/solr/util/TimeZoneUtilsTest.java (original)
+++ lucene/dev/branches/lucene5376_2/solr/core/src/test/org/apache/solr/util/TimeZoneUtilsTest.java Sun Mar 16 19:39:10 2014
@@ -46,7 +46,7 @@ public class TimeZoneUtilsTest extends L
public void testValidIds() throws Exception {
- final Set<String> idsTested = new HashSet<String>();
+ final Set<String> idsTested = new HashSet<>();
// brain dead: anything the JVM supports, should work
for (String validId : TimeZone.getAvailableIDs()) {
Modified: lucene/dev/branches/lucene5376_2/solr/example/solr/collection1/conf/schema.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5376_2/solr/example/solr/collection1/conf/schema.xml?rev=1578144&r1=1578143&r2=1578144&view=diff
==============================================================================
--- lucene/dev/branches/lucene5376_2/solr/example/solr/collection1/conf/schema.xml (original)
+++ lucene/dev/branches/lucene5376_2/solr/example/solr/collection1/conf/schema.xml Sun Mar 16 19:39:10 2014
@@ -448,6 +448,14 @@
</analyzer>
</fieldType>
+ <!-- A text type for English text where stopwords and synonyms are managed using the REST API -->
+ <fieldType name="managed_en" class="solr.TextField" positionIncrementGap="100">
+ <analyzer>
+ <tokenizer class="solr.StandardTokenizerFactory"/>
+ <filter class="solr.ManagedStopFilterFactory" managed="english" />
+ </analyzer>
+ </fieldType>
+
<!-- A general text field that has reasonable, generic
cross-language defaults: it tokenizes with StandardTokenizer,
removes stop words from case-insensitive "stopwords.txt"
@@ -1124,6 +1132,7 @@
<fieldType name="text_tr" class="solr.TextField" positionIncrementGap="100">
<analyzer>
<tokenizer class="solr.StandardTokenizerFactory"/>
+ <filter class="solr.ApostropheFilterFactory"/>
<filter class="solr.TurkishLowerCaseFilterFactory"/>
<filter class="solr.StopFilterFactory" ignoreCase="false" words="lang/stopwords_tr.txt" />
<filter class="solr.SnowballPorterFilterFactory" language="Turkish"/>
Modified: lucene/dev/branches/lucene5376_2/solr/example/solr/collection1/conf/solrconfig.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5376_2/solr/example/solr/collection1/conf/solrconfig.xml?rev=1578144&r1=1578143&r2=1578144&view=diff
==============================================================================
--- lucene/dev/branches/lucene5376_2/solr/example/solr/collection1/conf/solrconfig.xml (original)
+++ lucene/dev/branches/lucene5376_2/solr/example/solr/collection1/conf/solrconfig.xml Sun Mar 16 19:39:10 2014
@@ -129,6 +129,9 @@
<str name="solr.hdfs.confdir">${solr.hdfs.confdir:}</str>
<!-- Enable/Disable the hdfs cache. -->
<str name="solr.hdfs.blockcache.enabled">${solr.hdfs.blockcache.enabled:true}</str>
+ <!-- Enable/Disable using one global cache for all SolrCores.
+ The settings used will be from the first HdfsDirectoryFactory created. -->
+ <str name="solr.hdfs.blockcache.global">${solr.hdfs.blockcache.global:true}</str>
</directoryFactory>
Modified: lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/SolrQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/SolrQuery.java?rev=1578144&r1=1578143&r2=1578144&view=diff
==============================================================================
--- lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/SolrQuery.java (original)
+++ lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/SolrQuery.java Sun Mar 16 19:39:10 2014
@@ -620,7 +620,7 @@ public class SolrQuery extends Modifiabl
* @since 4.2
*/
public SolrQuery setSorts(List<SortClause> value) {
- sortClauses = new ArrayList<SortClause>(value);
+ sortClauses = new ArrayList<>(value);
serializeSorts();
return this;
}
@@ -674,7 +674,7 @@ public class SolrQuery extends Modifiabl
* @since 4.2
*/
public SolrQuery addSort(SortClause sortClause) {
- if (sortClauses == null) sortClauses = new ArrayList<SortClause>();
+ if (sortClauses == null) sortClauses = new ArrayList<>();
sortClauses.add(sortClause);
serializeSorts();
return this;
Modified: lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/SolrServer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/SolrServer.java?rev=1578144&r1=1578143&r2=1578144&view=diff
==============================================================================
--- lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/SolrServer.java (original)
+++ lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/SolrServer.java Sun Mar 16 19:39:10 2014
@@ -86,7 +86,7 @@ public abstract class SolrServer impleme
*/
public UpdateResponse addBeans(Collection<?> beans, int commitWithinMs) throws SolrServerException, IOException {
DocumentObjectBinder binder = this.getBinder();
- ArrayList<SolrInputDocument> docs = new ArrayList<SolrInputDocument>(beans.size());
+ ArrayList<SolrInputDocument> docs = new ArrayList<>(beans.size());
for (Object bean : beans) {
docs.add(binder.toSolrInputDocument(bean));
}
Modified: lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/beans/DocumentObjectBinder.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/beans/DocumentObjectBinder.java?rev=1578144&r1=1578143&r2=1578144&view=diff
==============================================================================
--- lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/beans/DocumentObjectBinder.java (original)
+++ lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/beans/DocumentObjectBinder.java Sun Mar 16 19:39:10 2014
@@ -34,14 +34,14 @@ import java.nio.ByteBuffer;
*/
public class DocumentObjectBinder {
- private final Map<Class, List<DocField>> infocache = new ConcurrentHashMap<Class, List<DocField>>();
+ private final Map<Class, List<DocField>> infocache = new ConcurrentHashMap<>();
public DocumentObjectBinder() {
}
public <T> List<T> getBeans(Class<T> clazz, SolrDocumentList solrDocList) {
List<DocField> fields = getDocFields(clazz);
- List<T> result = new ArrayList<T>(solrDocList.size());
+ List<T> result = new ArrayList<>(solrDocList.size());
for (SolrDocument sdoc : solrDocList) {
result.add(getBean(clazz, fields, sdoc));
@@ -103,9 +103,9 @@ public class DocumentObjectBinder {
}
private List<DocField> collectInfo(Class clazz) {
- List<DocField> fields = new ArrayList<DocField>();
+ List<DocField> fields = new ArrayList<>();
Class superClazz = clazz;
- List<AccessibleObject> members = new ArrayList<AccessibleObject>();
+ List<AccessibleObject> members = new ArrayList<>();
while (superClazz != null && superClazz != Object.class) {
members.addAll(Arrays.asList(superClazz.getDeclaredFields()));
@@ -275,7 +275,7 @@ public class DocumentObjectBinder {
Map<String, Object> allValuesMap = null;
List allValuesList = null;
if (isContainedInMap) {
- allValuesMap = new HashMap<String, Object>();
+ allValuesMap = new HashMap<>();
} else {
allValuesList = new ArrayList();
}
Modified: lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BinaryRequestWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BinaryRequestWriter.java?rev=1578144&r1=1578143&r2=1578144&view=diff
==============================================================================
--- lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BinaryRequestWriter.java (original)
+++ lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BinaryRequestWriter.java Sun Mar 16 19:39:10 2014
@@ -46,7 +46,7 @@ public class BinaryRequestWriter extends
&& (updateRequest.getDocIterator() == null) ) {
return null;
}
- List<ContentStream> l = new ArrayList<ContentStream>();
+ List<ContentStream> l = new ArrayList<>();
l.add(new LazyContentStream(updateRequest));
return l;
} else {
Modified: lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrServer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrServer.java?rev=1578144&r1=1578143&r2=1578144&view=diff
==============================================================================
--- lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrServer.java (original)
+++ lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrServer.java Sun Mar 16 19:39:10 2014
@@ -97,7 +97,7 @@ public class CloudSolrServer extends Sol
private String idField = "id";
private final Set<String> NON_ROUTABLE_PARAMS;
{
- NON_ROUTABLE_PARAMS = new HashSet<String>();
+ NON_ROUTABLE_PARAMS = new HashSet<>();
NON_ROUTABLE_PARAMS.add(UpdateParams.EXPUNGE_DELETES);
NON_ROUTABLE_PARAMS.add(UpdateParams.MAX_OPTIMIZE_SEGMENTS);
NON_ROUTABLE_PARAMS.add(UpdateParams.COMMIT);
@@ -322,7 +322,7 @@ public class CloudSolrServer extends Sol
long start = System.nanoTime();
if (parallelUpdates) {
- final Map<String, Future<NamedList<?>>> responseFutures = new HashMap<String, Future<NamedList<?>>>(routes.size());
+ final Map<String, Future<NamedList<?>>> responseFutures = new HashMap<>(routes.size());
for (final Map.Entry<String, LBHttpSolrServer.Req> entry : routes.entrySet()) {
final String url = entry.getKey();
final LBHttpSolrServer.Req lbRequest = entry.getValue();
@@ -373,7 +373,7 @@ public class CloudSolrServer extends Sol
Set<String> paramNames = nonRoutableParams.getParameterNames();
- Set<String> intersection = new HashSet<String>(paramNames);
+ Set<String> intersection = new HashSet<>(paramNames);
intersection.retainAll(NON_ROUTABLE_PARAMS);
if (nonRoutableRequest != null || intersection.size() > 0) {
@@ -381,7 +381,7 @@ public class CloudSolrServer extends Sol
nonRoutableRequest = new UpdateRequest();
}
nonRoutableRequest.setParams(nonRoutableParams);
- List<String> urlList = new ArrayList<String>();
+ List<String> urlList = new ArrayList<>();
urlList.addAll(routes.keySet());
Collections.shuffle(urlList, rand);
LBHttpSolrServer.Req req = new LBHttpSolrServer.Req(nonRoutableRequest, urlList);
@@ -402,13 +402,13 @@ public class CloudSolrServer extends Sol
}
private Map<String,List<String>> buildUrlMap(DocCollection col) {
- Map<String, List<String>> urlMap = new HashMap<String, List<String>>();
+ Map<String, List<String>> urlMap = new HashMap<>();
Collection<Slice> slices = col.getActiveSlices();
Iterator<Slice> sliceIterator = slices.iterator();
while (sliceIterator.hasNext()) {
Slice slice = sliceIterator.next();
String name = slice.getName();
- List<String> urls = new ArrayList<String>();
+ List<String> urls = new ArrayList<>();
Replica leader = slice.getLeader();
if (leader == null) {
// take unoptimized general path - we cannot find a leader yet
@@ -514,14 +514,14 @@ public class CloudSolrServer extends Sol
}
}
sendToLeaders = true;
- replicas = new ArrayList<String>();
+ replicas = new ArrayList<>();
}
SolrParams reqParams = request.getParams();
if (reqParams == null) {
reqParams = new ModifiableSolrParams();
}
- List<String> theUrlList = new ArrayList<String>();
+ List<String> theUrlList = new ArrayList<>();
if (request.getPath().equals("/admin/collections")
|| request.getPath().equals("/admin/cores")) {
Set<String> liveNodes = clusterState.getLiveNodes();
@@ -549,7 +549,7 @@ public class CloudSolrServer extends Sol
// Retrieve slices from the cloud state and, for each collection
// specified,
// add it to the Map of slices.
- Map<String,Slice> slices = new HashMap<String,Slice>();
+ Map<String,Slice> slices = new HashMap<>();
for (String collectionName : collectionsList) {
Collection<Slice> colSlices = clusterState
.getActiveSlices(collectionName);
@@ -567,8 +567,8 @@ public class CloudSolrServer extends Sol
// build a map of unique nodes
// TODO: allow filtering by group, role, etc
- Map<String,ZkNodeProps> nodes = new HashMap<String,ZkNodeProps>();
- List<String> urlList2 = new ArrayList<String>();
+ Map<String,ZkNodeProps> nodes = new HashMap<>();
+ List<String> urlList2 = new ArrayList<>();
for (Slice slice : slices.values()) {
for (ZkNodeProps nodeProps : slice.getReplicasMap().values()) {
ZkCoreNodeProps coreNodeProps = new ZkCoreNodeProps(nodeProps);
@@ -609,15 +609,15 @@ public class CloudSolrServer extends Sol
}
if (sendToLeaders) {
- theUrlList = new ArrayList<String>(leaderUrlList.size());
+ theUrlList = new ArrayList<>(leaderUrlList.size());
theUrlList.addAll(leaderUrlList);
} else {
- theUrlList = new ArrayList<String>(urlList.size());
+ theUrlList = new ArrayList<>(urlList.size());
theUrlList.addAll(urlList);
}
Collections.shuffle(theUrlList, rand);
if (sendToLeaders) {
- ArrayList<String> theReplicas = new ArrayList<String>(
+ ArrayList<String> theReplicas = new ArrayList<>(
replicasList.size());
theReplicas.addAll(replicasList);
Collections.shuffle(theReplicas, rand);
@@ -640,7 +640,7 @@ public class CloudSolrServer extends Sol
String collection) {
// Extract each comma separated collection name and store in a List.
List<String> rawCollectionsList = StrUtils.splitSmart(collection, ",", true);
- Set<String> collectionsList = new HashSet<String>();
+ Set<String> collectionsList = new HashSet<>();
// validate collections
for (String collectionName : rawCollectionsList) {
if (!clusterState.getCollections().contains(collectionName)) {
Modified: lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrServer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrServer.java?rev=1578144&r1=1578143&r2=1578144&view=diff
==============================================================================
--- lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrServer.java (original)
+++ lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrServer.java Sun Mar 16 19:39:10 2014
@@ -121,9 +121,9 @@ public class ConcurrentUpdateSolrServer
HttpClient client, int queueSize, int threadCount, ExecutorService es, boolean streamDeletes) {
this.server = new HttpSolrServer(solrServerUrl, client);
this.server.setFollowRedirects(false);
- queue = new LinkedBlockingQueue<UpdateRequest>(queueSize);
+ queue = new LinkedBlockingQueue<>(queueSize);
this.threadCount = threadCount;
- runners = new LinkedList<Runner>();
+ runners = new LinkedList<>();
scheduler = es;
this.streamDeletes = streamDeletes;
}
@@ -283,8 +283,8 @@ public class ConcurrentUpdateSolrServer
if ((req.getDocuments() == null || req.getDocuments().isEmpty())
&& (req.getDeleteById() == null || req.getDeleteById().isEmpty())
&& (req.getDeleteByIdMap() == null || req.getDeleteByIdMap().isEmpty())) {
- blockUntilFinished();
if (req.getDeleteQuery() == null) {
+ blockUntilFinished();
return server.request(request);
}
}
@@ -364,7 +364,7 @@ public class ConcurrentUpdateSolrServer
}
// RETURN A DUMMY result
- NamedList<Object> dummy = new NamedList<Object>();
+ NamedList<Object> dummy = new NamedList<>();
dummy.add("NOTE", "the request is processed in a background stream");
return dummy;
}
Modified: lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrServer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrServer.java?rev=1578144&r1=1578143&r2=1578144&view=diff
==============================================================================
--- lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrServer.java (original)
+++ lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrServer.java Sun Mar 16 19:39:10 2014
@@ -86,7 +86,7 @@ public class HttpSolrServer extends Solr
/**
* The URL of the Solr server.
*/
- protected String baseUrl;
+ protected volatile String baseUrl;
/**
* Default value: null / empty.
@@ -115,14 +115,14 @@ public class HttpSolrServer extends Solr
private final HttpClient httpClient;
- private boolean followRedirects = false;
+ private volatile boolean followRedirects = false;
- private int maxRetries = 0;
+ private volatile int maxRetries = 0;
- private boolean useMultiPartPost;
+ private volatile boolean useMultiPartPost;
private final boolean internalClient;
- private Set<String> queryParams = Collections.emptySet();
+ private volatile Set<String> queryParams = Collections.emptySet();
/**
* @param baseURL
@@ -199,8 +199,11 @@ public class HttpSolrServer extends Solr
return request(request, responseParser);
}
- public NamedList<Object> request(final SolrRequest request,
- final ResponseParser processor) throws SolrServerException, IOException {
+ public NamedList<Object> request(final SolrRequest request, final ResponseParser processor) throws SolrServerException, IOException {
+ return executeMethod(createMethod(request),processor);
+ }
+
+ protected HttpRequestBase createMethod(final SolrRequest request) throws IOException, SolrServerException {
HttpRequestBase method = null;
InputStream is = null;
SolrParams params = request.getParams();
@@ -266,7 +269,7 @@ public class HttpSolrServer extends Solr
}
}
- LinkedList<NameValuePair> postParams = new LinkedList<NameValuePair>();
+ LinkedList<NameValuePair> postParams = new LinkedList<>();
if (streams == null || isMultipart) {
HttpPost post = new HttpPost(url + ClientUtils.toQueryString( queryParams, false ));
post.setHeader("Content-Charset", "UTF-8");
@@ -275,7 +278,7 @@ public class HttpSolrServer extends Solr
"application/x-www-form-urlencoded; charset=UTF-8");
}
- List<FormBodyPart> parts = new LinkedList<FormBodyPart>();
+ List<FormBodyPart> parts = new LinkedList<>();
Iterator<String> iter = wparams.getParameterNamesIterator();
while (iter.hasNext()) {
String p = iter.next();
@@ -382,6 +385,10 @@ public class HttpSolrServer extends Solr
throw new SolrServerException("error reading streams", ex);
}
+ return method;
+ }
+
+ protected NamedList<Object> executeMethod(HttpRequestBase method, final ResponseParser processor) throws SolrServerException {
// XXX client already has this set, is this needed?
method.getParams().setParameter(ClientPNames.HANDLE_REDIRECTS,
followRedirects);
@@ -429,7 +436,7 @@ public class HttpSolrServer extends Solr
if (processor == null) {
// no processor specified, return raw stream
- NamedList<Object> rsp = new NamedList<Object>();
+ NamedList<Object> rsp = new NamedList<>();
rsp.add("stream", respBody);
// Only case where stream should not be closed
shouldClose = false;
Modified: lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttpSolrServer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttpSolrServer.java?rev=1578144&r1=1578143&r2=1578144&view=diff
==============================================================================
--- lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttpSolrServer.java (original)
+++ lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttpSolrServer.java Sun Mar 16 19:39:10 2014
@@ -76,7 +76,7 @@ import java.util.*;
* @since solr 1.4
*/
public class LBHttpSolrServer extends SolrServer {
- private static Set<Integer> RETRY_CODES = new HashSet<Integer>(4);
+ private static Set<Integer> RETRY_CODES = new HashSet<>(4);
static {
RETRY_CODES.add(404);
@@ -87,10 +87,10 @@ public class LBHttpSolrServer extends So
// keys to the maps are currently of the form "http://localhost:8983/solr"
// which should be equivalent to CommonsHttpSolrServer.getBaseURL()
- private final Map<String, ServerWrapper> aliveServers = new LinkedHashMap<String, ServerWrapper>();
+ private final Map<String, ServerWrapper> aliveServers = new LinkedHashMap<>();
// access to aliveServers should be synchronized on itself
- protected final Map<String, ServerWrapper> zombieServers = new ConcurrentHashMap<String, ServerWrapper>();
+ protected final Map<String, ServerWrapper> zombieServers = new ConcurrentHashMap<>();
// changes to aliveServers are reflected in this array, no need to synchronize
private volatile ServerWrapper[] aliveServerList = new ServerWrapper[0];
@@ -283,7 +283,7 @@ public class LBHttpSolrServer extends So
Rsp rsp = new Rsp();
Exception ex = null;
boolean isUpdate = req.request instanceof IsUpdateRequest;
- List<ServerWrapper> skipped = new ArrayList<ServerWrapper>(req.getNumDeadServersToTry());
+ List<ServerWrapper> skipped = new ArrayList<>(req.getNumDeadServersToTry());
for (String serverStr : req.getServers()) {
serverStr = normalize(serverStr);
@@ -505,7 +505,7 @@ public class LBHttpSolrServer extends So
if (e.getRootCause() instanceof IOException) {
ex = e;
moveAliveToDead(wrapper);
- if (justFailed == null) justFailed = new HashMap<String,ServerWrapper>();
+ if (justFailed == null) justFailed = new HashMap<>();
justFailed.put(wrapper.getKey(), wrapper);
} else {
throw e;
@@ -619,7 +619,7 @@ public class LBHttpSolrServer extends So
aliveCheckExecutor = Executors.newSingleThreadScheduledExecutor(
new SolrjNamedThreadFactory("aliveCheckExecutor"));
aliveCheckExecutor.scheduleAtFixedRate(
- getAliveCheckRunner(new WeakReference<LBHttpSolrServer>(this)),
+ getAliveCheckRunner(new WeakReference<>(this)),
this.interval, this.interval, TimeUnit.MILLISECONDS);
}
}
Modified: lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/impl/XMLResponseParser.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/impl/XMLResponseParser.java?rev=1578144&r1=1578143&r2=1578144&view=diff
==============================================================================
--- lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/impl/XMLResponseParser.java (original)
+++ lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/impl/XMLResponseParser.java Sun Mar 16 19:39:10 2014
@@ -135,7 +135,7 @@ public class XMLResponseParser extends R
response = readNamedList( parser );
}
else if( name.equals( "solr" ) ) {
- return new SimpleOrderedMap<Object>();
+ return new SimpleOrderedMap<>();
}
else {
throw new Exception( "really needs to be response or result. " +
@@ -212,7 +212,7 @@ public class XMLResponseParser extends R
}
StringBuilder builder = new StringBuilder();
- NamedList<Object> nl = new SimpleOrderedMap<Object>();
+ NamedList<Object> nl = new SimpleOrderedMap<>();
KnownType type = null;
String name = null;
@@ -284,7 +284,7 @@ public class XMLResponseParser extends R
StringBuilder builder = new StringBuilder();
KnownType type = null;
- List<Object> vals = new ArrayList<Object>();
+ List<Object> vals = new ArrayList<>();
int depth = 0;
while( true )
Modified: lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/request/AbstractUpdateRequest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/request/AbstractUpdateRequest.java?rev=1578144&r1=1578143&r2=1578144&view=diff
==============================================================================
--- lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/request/AbstractUpdateRequest.java (original)
+++ lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/request/AbstractUpdateRequest.java Sun Mar 16 19:39:10 2014
@@ -24,6 +24,7 @@ import org.apache.solr.common.params.Mod
import org.apache.solr.common.params.UpdateParams;
import java.io.IOException;
+import java.util.concurrent.TimeUnit;
/**
@@ -112,10 +113,11 @@ public abstract class AbstractUpdateRequ
@Override
public UpdateResponse process( SolrServer server ) throws SolrServerException, IOException
{
- long startTime = System.currentTimeMillis();
+ long startTime = TimeUnit.MILLISECONDS.convert(System.nanoTime(), TimeUnit.NANOSECONDS);
UpdateResponse res = new UpdateResponse();
res.setResponse( server.request( this ) );
- res.setElapsedTime( System.currentTimeMillis()-startTime );
+ long endTime = TimeUnit.MILLISECONDS.convert(System.nanoTime(), TimeUnit.NANOSECONDS);
+ res.setElapsedTime(endTime - startTime);
return res;
}
Modified: lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/request/CollectionAdminRequest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/request/CollectionAdminRequest.java?rev=1578144&r1=1578143&r2=1578144&view=diff
==============================================================================
--- lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/request/CollectionAdminRequest.java (original)
+++ lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/request/CollectionAdminRequest.java Sun Mar 16 19:39:10 2014
@@ -17,20 +17,21 @@
package org.apache.solr.client.solrj.request;
-import java.io.IOException;
-import java.util.Collection;
-
import org.apache.solr.client.solrj.SolrRequest;
import org.apache.solr.client.solrj.SolrServer;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.response.CollectionAdminResponse;
import org.apache.solr.common.cloud.ZkStateReader;
import org.apache.solr.common.params.CollectionParams.CollectionAction;
-import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.common.params.CoreAdminParams;
+import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.common.params.SolrParams;
import org.apache.solr.common.util.ContentStream;
+import java.io.IOException;
+import java.util.Collection;
+import java.util.concurrent.TimeUnit;
+
/**
* This class is experimental and subject to change.
*
@@ -40,6 +41,7 @@ public class CollectionAdminRequest exte
{
protected String collection = null;
protected CollectionAction action = null;
+ protected String asyncId = null;
protected static class CollectionShardAdminRequest extends CollectionAdminRequest {
protected String shardName = null;
@@ -52,6 +54,7 @@ public class CollectionAdminRequest exte
params.remove( "name" );
params.set( "collection", collection );
params.set( "shard", shardName);
+ params.set( "async", asyncId);
return params;
}
@@ -123,6 +126,9 @@ public class CollectionAdminRequest exte
// OverseerCollectionProcessor.REPLICATION_FACTOR
params.set( "replicationFactor", replicationFactor);
}
+ if (asyncId != null) {
+ params.set("async", asyncId);
+ }
return params;
}
@@ -187,6 +193,25 @@ public class CollectionAdminRequest exte
}
}
+ //a request status collection request
+ public static class RequestStatus extends CollectionAdminRequest {
+ protected String requestId = null;
+
+ public RequestStatus() {
+ action = CollectionAction.REQUESTSTATUS;
+ }
+
+ public void setRequestId(String requestId) {this.requestId = requestId; }
+ public String getRequestId() { return this.requestId; }
+
+ @Override
+ public SolrParams getParams() {
+ ModifiableSolrParams params = (ModifiableSolrParams) super.getParams();
+ params.set("requestid", requestId);
+ return params;
+ }
+ }
+
//a collection alias create request
public static class CreateAlias extends CollectionAdminRequest {
protected String aliasedCollections = null;
@@ -238,6 +263,10 @@ public class CollectionAdminRequest exte
this.action = action;
}
+ public void setAsyncId(String asyncId) {
+ this.asyncId = asyncId;
+ }
+
//---------------------------------------------------------------------------------------
//
//---------------------------------------------------------------------------------------
@@ -266,10 +295,11 @@ public class CollectionAdminRequest exte
@Override
public CollectionAdminResponse process(SolrServer server) throws SolrServerException, IOException
{
- long startTime = System.currentTimeMillis();
+ long startTime = TimeUnit.MILLISECONDS.convert(System.nanoTime(), TimeUnit.NANOSECONDS);
CollectionAdminResponse res = new CollectionAdminResponse();
res.setResponse( server.request( this ) );
- res.setElapsedTime( System.currentTimeMillis()-startTime );
+ long endTime = TimeUnit.MILLISECONDS.convert(System.nanoTime(), TimeUnit.NANOSECONDS);
+ res.setElapsedTime(endTime - startTime);
return res;
}
@@ -283,7 +313,19 @@ public class CollectionAdminRequest exte
String nodeSet,
String conf,
String routerField,
- SolrServer server ) throws SolrServerException, IOException
+ SolrServer server) throws SolrServerException, IOException
+ {
+ return createCollection(name, shards, repl, maxShards, nodeSet, conf, routerField, server, null);
+ }
+
+ // creates collection using a compositeId router
+ public static CollectionAdminResponse createCollection( String name,
+ Integer shards, Integer repl, Integer maxShards,
+ String nodeSet,
+ String conf,
+ String routerField,
+ SolrServer server,
+ String asyncId) throws SolrServerException, IOException
{
Create req = new Create();
req.setCollectionName(name);
@@ -294,27 +336,47 @@ public class CollectionAdminRequest exte
req.setCreateNodeSet(nodeSet);
req.setConfigName(conf);
req.setRouterField(routerField);
+ req.setAsyncId(asyncId);
return req.process( server );
}
+
+ public static CollectionAdminResponse createCollection(String name, Integer shards,
+ String conf,
+ SolrServer server) throws SolrServerException, IOException {
+ return createCollection(name, shards, conf, server, null);
+ }
+
public static CollectionAdminResponse createCollection( String name,
Integer shards, String conf,
- SolrServer server ) throws SolrServerException, IOException
+ SolrServer server,
+ String asyncId) throws SolrServerException, IOException
{
Create req = new Create();
req.setCollectionName(name);
req.setRouterName("compositeId");
req.setNumShards(shards);
req.setConfigName(conf);
+ req.setAsyncId(asyncId);
return req.process( server );
}
+ public static CollectionAdminResponse createCollection(String name,
+ String shards,
+ Integer repl, Integer maxShards,
+ String conf,
+ String routerField,
+ SolrServer server) throws SolrServerException, IOException {
+ return createCollection(name, shards, repl, maxShards, conf, routerField, null);
+ }
+
// creates a collection using an implicit router
public static CollectionAdminResponse createCollection( String name,
String shards, Integer repl, Integer maxShards,
String nodeSet,
String conf,
String routerField,
- SolrServer server ) throws SolrServerException, IOException
+ SolrServer server,
+ String asyncId) throws SolrServerException, IOException
{
Create req = new Create();
req.setCollectionName(name);
@@ -325,34 +387,68 @@ public class CollectionAdminRequest exte
req.setCreateNodeSet(nodeSet);
req.setConfigName(conf);
req.setRouterField(routerField);
+ req.setAsyncId(asyncId);
return req.process( server );
}
+
+ public static CollectionAdminResponse createCollection( String name,
+ String shards, String conf,
+ SolrServer server) throws SolrServerException, IOException
+ {
+ return createCollection(name, shards, conf, server, null);
+ }
+
public static CollectionAdminResponse createCollection( String name,
String shards, String conf,
- SolrServer server ) throws SolrServerException, IOException
+ SolrServer server, String asyncId ) throws SolrServerException, IOException
{
Create req = new Create();
req.setCollectionName(name);
req.setRouterName("implicit");
req.setShards(shards);
req.setConfigName(conf);
+ req.setAsyncId(asyncId);
return req.process( server );
}
- public static CollectionAdminResponse reloadCollection( String name, SolrServer server ) throws SolrServerException, IOException
+ public static CollectionAdminResponse reloadCollection( String name, SolrServer server)
+ throws SolrServerException, IOException {
+ return reloadCollection(name, server, null);
+ }
+
+ public static CollectionAdminResponse reloadCollection( String name, SolrServer server, String asyncId )
+ throws SolrServerException, IOException
{
CollectionAdminRequest req = new Reload();
req.setCollectionName(name);
+ req.setAsyncId(asyncId);
return req.process( server );
}
- public static CollectionAdminResponse deleteCollection( String name, SolrServer server ) throws SolrServerException, IOException
+ public static CollectionAdminResponse deleteCollection( String name, SolrServer server)
+ throws SolrServerException, IOException
+ {
+ return deleteCollection(name, server, null);
+ }
+
+ public static CollectionAdminResponse deleteCollection( String name, SolrServer server,
+ String asyncId)
+ throws SolrServerException, IOException
{
CollectionAdminRequest req = new Delete();
req.setCollectionName(name);
+ req.setAsyncId(asyncId);
return req.process( server );
}
+ public static CollectionAdminResponse requestStatus(String requestId, SolrServer server)
+ throws SolrServerException, IOException {
+ RequestStatus req = new RequestStatus();
+
+ req.setRequestId(requestId);
+ return req.process(server);
+ }
+
public static CollectionAdminResponse createShard( String name, String shard, String nodeSet, SolrServer server ) throws SolrServerException, IOException
{
CreateShard req = new CreateShard();
@@ -368,15 +464,29 @@ public class CollectionAdminRequest exte
public static CollectionAdminResponse splitShard( String name, String shard, String ranges, SolrServer server ) throws SolrServerException, IOException
{
+ return splitShard(name, shard, ranges, server, null);
+ }
+
+ public static CollectionAdminResponse splitShard( String name, String shard, String ranges, SolrServer server,
+ String asyncId) throws SolrServerException, IOException
+ {
SplitShard req = new SplitShard();
req.setCollectionName(name);
req.setShardName(shard);
req.setRanges(ranges);
+ req.setAsyncId(asyncId);
return req.process( server );
}
- public static CollectionAdminResponse splitShard( String name, String shard, SolrServer server ) throws SolrServerException, IOException
+
+ public static CollectionAdminResponse splitShard(String name, String shard, SolrServer server)
+ throws SolrServerException, IOException {
+ return splitShard(name, shard, null, server, null);
+ }
+
+ public static CollectionAdminResponse splitShard( String name, String shard, SolrServer server,
+ String asyncId ) throws SolrServerException, IOException
{
- return splitShard(name, shard, null, server);
+ return splitShard(name, shard, null, server, asyncId);
}
public static CollectionAdminResponse deleteShard( String name, String shard, SolrServer server ) throws SolrServerException, IOException
Modified: lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/request/ContentStreamUpdateRequest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/request/ContentStreamUpdateRequest.java?rev=1578144&r1=1578143&r2=1578144&view=diff
==============================================================================
--- lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/request/ContentStreamUpdateRequest.java (original)
+++ lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/request/ContentStreamUpdateRequest.java Sun Mar 16 19:39:10 2014
@@ -45,7 +45,7 @@ public class ContentStreamUpdateRequest
*/
public ContentStreamUpdateRequest(String url) {
super(METHOD.POST, url);
- contentStreams = new ArrayList<ContentStream>();
+ contentStreams = new ArrayList<>();
}
@Override
Modified: lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/request/CoreAdminRequest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/request/CoreAdminRequest.java?rev=1578144&r1=1578143&r2=1578144&view=diff
==============================================================================
--- lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/request/CoreAdminRequest.java (original)
+++ lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/request/CoreAdminRequest.java Sun Mar 16 19:39:10 2014
@@ -32,6 +32,7 @@ import java.io.IOException;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
+import java.util.concurrent.TimeUnit;
/**
* This class is experimental and subject to change.
@@ -487,10 +488,11 @@ public class CoreAdminRequest extends So
@Override
public CoreAdminResponse process(SolrServer server) throws SolrServerException, IOException
{
- long startTime = System.currentTimeMillis();
+ long startTime = TimeUnit.MILLISECONDS.convert(System.nanoTime(), TimeUnit.NANOSECONDS);
CoreAdminResponse res = new CoreAdminResponse();
res.setResponse( server.request( this ) );
- res.setElapsedTime( System.currentTimeMillis()-startTime );
+ long endTime = TimeUnit.MILLISECONDS.convert(System.nanoTime(), TimeUnit.NANOSECONDS);
+ res.setElapsedTime(endTime - startTime);
return res;
}
Modified: lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/request/DirectXmlRequest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/request/DirectXmlRequest.java?rev=1578144&r1=1578143&r2=1578144&view=diff
==============================================================================
--- lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/request/DirectXmlRequest.java (original)
+++ lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/request/DirectXmlRequest.java Sun Mar 16 19:39:10 2014
@@ -19,6 +19,7 @@ package org.apache.solr.client.solrj.req
import java.io.IOException;
import java.util.Collection;
+import java.util.concurrent.TimeUnit;
import org.apache.solr.client.solrj.SolrServer;
import org.apache.solr.client.solrj.SolrServerException;
@@ -63,10 +64,10 @@ public class DirectXmlRequest extends So
@Override
public UpdateResponse process( SolrServer server ) throws SolrServerException, IOException
{
- long startTime = System.currentTimeMillis();
+ long startTime = TimeUnit.MILLISECONDS.convert(System.nanoTime(), TimeUnit.NANOSECONDS);
UpdateResponse res = new UpdateResponse();
res.setResponse( server.request( this ) );
- res.setElapsedTime( System.currentTimeMillis()-startTime );
+ res.setElapsedTime( TimeUnit.MILLISECONDS.convert(System.nanoTime()-startTime, TimeUnit.NANOSECONDS) );
return res;
}
}
Modified: lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/request/DocumentAnalysisRequest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/request/DocumentAnalysisRequest.java?rev=1578144&r1=1578143&r2=1578144&view=diff
==============================================================================
--- lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/request/DocumentAnalysisRequest.java (original)
+++ lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/request/DocumentAnalysisRequest.java Sun Mar 16 19:39:10 2014
@@ -32,6 +32,7 @@ import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
+import java.util.concurrent.TimeUnit;
/**
* A request for the org.apache.solr.handler.DocumentAnalysisRequestHandler.
@@ -41,7 +42,7 @@ import java.util.List;
*/
public class DocumentAnalysisRequest extends SolrRequest {
- private List<SolrInputDocument> documents = new ArrayList<SolrInputDocument>();
+ private List<SolrInputDocument> documents = new ArrayList<>();
private String query;
private boolean showMatch = false;
@@ -87,10 +88,11 @@ public class DocumentAnalysisRequest ext
*/
@Override
public DocumentAnalysisResponse process(SolrServer server) throws SolrServerException, IOException {
- long startTime = System.currentTimeMillis();
+ long startTime = TimeUnit.MILLISECONDS.convert(System.nanoTime(), TimeUnit.NANOSECONDS);
DocumentAnalysisResponse res = new DocumentAnalysisResponse();
res.setResponse(server.request(this));
- res.setElapsedTime(System.currentTimeMillis() - startTime);
+ long endTime = TimeUnit.MILLISECONDS.convert(System.nanoTime(), TimeUnit.NANOSECONDS);
+ res.setElapsedTime(endTime - startTime);
return res;
}
Modified: lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/request/FieldAnalysisRequest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/request/FieldAnalysisRequest.java?rev=1578144&r1=1578143&r2=1578144&view=diff
==============================================================================
--- lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/request/FieldAnalysisRequest.java (original)
+++ lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/request/FieldAnalysisRequest.java Sun Mar 16 19:39:10 2014
@@ -30,6 +30,7 @@ import java.io.IOException;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
+import java.util.concurrent.TimeUnit;
/**
* A request for the org.apache.solr.handler.FieldAnalysisRequestHandler.
@@ -102,10 +103,11 @@ public class FieldAnalysisRequest extend
if (fieldValue == null) {
throw new IllegalStateException("The field value must be set");
}
- long startTime = System.currentTimeMillis();
+ long startTime = TimeUnit.MILLISECONDS.convert(System.nanoTime(), TimeUnit.NANOSECONDS);
FieldAnalysisResponse res = new FieldAnalysisResponse();
res.setResponse(server.request(this));
- res.setElapsedTime(System.currentTimeMillis() - startTime);
+ long endTime = TimeUnit.MILLISECONDS.convert(System.nanoTime(), TimeUnit.NANOSECONDS);
+ res.setElapsedTime(endTime - startTime);
return res;
}
@@ -210,7 +212,7 @@ public class FieldAnalysisRequest extend
*/
public FieldAnalysisRequest addFieldName(String fieldName) {
if (fieldNames == null) {
- fieldNames = new LinkedList<String>();
+ fieldNames = new LinkedList<>();
}
fieldNames.add(fieldName);
return this;
@@ -247,7 +249,7 @@ public class FieldAnalysisRequest extend
*/
public FieldAnalysisRequest addFieldType(String fieldTypeName) {
if (fieldTypes == null) {
- fieldTypes = new LinkedList<String>();
+ fieldTypes = new LinkedList<>();
}
fieldTypes.add(fieldTypeName);
return this;
Modified: lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/request/LukeRequest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/request/LukeRequest.java?rev=1578144&r1=1578143&r2=1578144&view=diff
==============================================================================
--- lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/request/LukeRequest.java (original)
+++ lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/request/LukeRequest.java Sun Mar 16 19:39:10 2014
@@ -21,6 +21,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
+import java.util.concurrent.TimeUnit;
import org.apache.solr.client.solrj.SolrServer;
import org.apache.solr.client.solrj.SolrServerException;
@@ -58,7 +59,7 @@ public class LukeRequest extends SolrReq
public void addField( String f )
{
if( fields == null ) {
- fields = new ArrayList<String>();
+ fields = new ArrayList<>();
}
fields.add( f );
}
@@ -116,10 +117,11 @@ public class LukeRequest extends SolrReq
@Override
public LukeResponse process( SolrServer server ) throws SolrServerException, IOException
{
- long startTime = System.currentTimeMillis();
+ long startTime = TimeUnit.MILLISECONDS.convert(System.nanoTime(), TimeUnit.NANOSECONDS);
LukeResponse res = new LukeResponse();
res.setResponse( server.request( this ) );
- res.setElapsedTime( System.currentTimeMillis()-startTime );
+ long endTime = TimeUnit.MILLISECONDS.convert(System.nanoTime(), TimeUnit.NANOSECONDS);
+ res.setElapsedTime(endTime - startTime);
return res;
}
}
Modified: lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/request/QueryRequest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/request/QueryRequest.java?rev=1578144&r1=1578143&r2=1578144&view=diff
==============================================================================
--- lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/request/QueryRequest.java (original)
+++ lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/request/QueryRequest.java Sun Mar 16 19:39:10 2014
@@ -27,6 +27,7 @@ import org.apache.solr.common.params.Sol
import org.apache.solr.common.util.ContentStream;
import java.util.Collection;
+import java.util.concurrent.TimeUnit;
/**
*
@@ -86,9 +87,10 @@ public class QueryRequest extends SolrRe
public QueryResponse process( SolrServer server ) throws SolrServerException
{
try {
- long startTime = System.currentTimeMillis();
+ long startTime = TimeUnit.MILLISECONDS.convert(System.nanoTime(), TimeUnit.NANOSECONDS);
QueryResponse res = new QueryResponse( server.request( this ), server );
- res.setElapsedTime( System.currentTimeMillis()-startTime );
+ long endTime = TimeUnit.MILLISECONDS.convert(System.nanoTime(), TimeUnit.NANOSECONDS);
+ res.setElapsedTime(endTime - startTime);
return res;
} catch (SolrServerException e){
throw e;
Modified: lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/request/RequestWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/request/RequestWriter.java?rev=1578144&r1=1578143&r2=1578144&view=diff
==============================================================================
--- lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/request/RequestWriter.java (original)
+++ lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/request/RequestWriter.java Sun Mar 16 19:39:10 2014
@@ -44,7 +44,7 @@ public class RequestWriter {
if (req instanceof UpdateRequest) {
UpdateRequest updateRequest = (UpdateRequest) req;
if (isEmpty(updateRequest)) return null;
- List<ContentStream> l = new ArrayList<ContentStream>();
+ List<ContentStream> l = new ArrayList<>();
l.add(new LazyContentStream(updateRequest));
return l;
}
Modified: lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/request/SolrPing.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/request/SolrPing.java?rev=1578144&r1=1578143&r2=1578144&view=diff
==============================================================================
--- lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/request/SolrPing.java (original)
+++ lucene/dev/branches/lucene5376_2/solr/solrj/src/java/org/apache/solr/client/solrj/request/SolrPing.java Sun Mar 16 19:39:10 2014
@@ -19,6 +19,7 @@ package org.apache.solr.client.solrj.req
import java.io.IOException;
import java.util.Collection;
+import java.util.concurrent.TimeUnit;
import org.apache.solr.client.solrj.SolrRequest;
import org.apache.solr.client.solrj.SolrServer;
@@ -64,10 +65,11 @@ public class SolrPing extends SolrReques
@Override
public SolrPingResponse process(SolrServer server)
throws SolrServerException, IOException {
- long startTime = System.currentTimeMillis();
+ long startTime = TimeUnit.MILLISECONDS.convert(System.nanoTime(), TimeUnit.NANOSECONDS);
SolrPingResponse res = new SolrPingResponse();
res.setResponse(server.request(this));
- res.setElapsedTime(System.currentTimeMillis() - startTime);
+ long endTime = TimeUnit.MILLISECONDS.convert(System.nanoTime(), TimeUnit.NANOSECONDS);
+ res.setElapsedTime(endTime - startTime);
return res;
}