lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From no...@apache.org
Subject [2/2] lucene-solr:branch_6x: SOLR-8750: replace anonymous inner class for callable, Runnable etc
Date Tue, 05 Apr 2016 17:51:42 GMT
SOLR-8750: replace anonymous inner class for callable, Runnable etc


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/88d2b3bf
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/88d2b3bf
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/88d2b3bf

Branch: refs/heads/branch_6x
Commit: 88d2b3bfbed3d823a13b486ba44cb2d219ae0941
Parents: d67ec54
Author: Noble Paul <noble@apache.org>
Authored: Tue Apr 5 23:21:07 2016 +0530
Committer: Noble Paul <noble@apache.org>
Committed: Tue Apr 5 23:21:07 2016 +0530

----------------------------------------------------------------------
 .../solr/cloud/BasicDistributedZkTest.java      | 80 +++++++++-----------
 1 file changed, 37 insertions(+), 43 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/88d2b3bf/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java b/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java
index 8222e91..4a6b2d7 100644
--- a/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java
@@ -959,35 +959,32 @@ public class BasicDistributedZkTest extends AbstractFullDistribZkTestBase
{
   private void createSolrCore(final String collection,
       List<SolrClient> collectionClients, final String baseUrl, final int num,
       final String shardId) {
-    Callable call = new Callable() {
-      @Override
-      public Object call() {
-        try (HttpSolrClient client = new HttpSolrClient(baseUrl)) {
-          client.setConnectionTimeout(15000);
-          Create createCmd = new Create();
-          createCmd.setRoles("none");
-          createCmd.setCoreName(collection + num);
-          createCmd.setCollection(collection);
-          
-          if (random().nextBoolean()) {
-            // sometimes we use an explicit core node name
-            createCmd.setCoreNodeName("anode" + nodeCounter.incrementAndGet());
-          }
-          
-          if (shardId == null) {
-            createCmd.setNumShards(2);
-          }
-          createCmd.setDataDir(getDataDir(createTempDir(collection).toFile().getAbsolutePath()));
-          if (shardId != null) {
-            createCmd.setShardId(shardId);
-          }
-          client.request(createCmd);
-        } catch (Exception e) {
-          e.printStackTrace();
-          //fail
+    Callable call = () -> {
+      try (HttpSolrClient client = new HttpSolrClient(baseUrl)) {
+        client.setConnectionTimeout(15000);
+        Create createCmd = new Create();
+        createCmd.setRoles("none");
+        createCmd.setCoreName(collection + num);
+        createCmd.setCollection(collection);
+
+        if (random().nextBoolean()) {
+          // sometimes we use an explicit core node name
+          createCmd.setCoreNodeName("anode" + nodeCounter.incrementAndGet());
         }
-        return null;
+
+        if (shardId == null) {
+          createCmd.setNumShards(2);
+        }
+        createCmd.setDataDir(getDataDir(createTempDir(collection).toFile().getAbsolutePath()));
+        if (shardId != null) {
+          createCmd.setShardId(shardId);
+        }
+        client.request(createCmd);
+      } catch (Exception e) {
+        e.printStackTrace();
+        //fail
       }
+      return null;
     };
     
     pending.add(completionService.submit(call));
@@ -1090,23 +1087,20 @@ public class BasicDistributedZkTest extends AbstractFullDistribZkTestBase
{
               ((HttpSolrClient) client).getBaseURL().length()
                   - DEFAULT_COLLECTION.length() -1);
       final int frozeUnique = unique;
-      Callable call = new Callable() {
-        @Override
-        public Object call() {
-
-          try (HttpSolrClient client = new HttpSolrClient(baseUrl)) {
-            client.setConnectionTimeout(15000);
-            client.setSoTimeout(60000);
-            Create createCmd = new Create();
-            createCmd.setCoreName(collection);
-            createCmd.setDataDir(getDataDir(createTempDir(collection).toFile().getAbsolutePath()));
-            client.request(createCmd);
-          } catch (Exception e) {
-            e.printStackTrace();
-            //fails
-          }
-          return null;
+      Callable call = () -> {
+
+        try (HttpSolrClient client1 = new HttpSolrClient(baseUrl)) {
+          client1.setConnectionTimeout(15000);
+          client1.setSoTimeout(60000);
+          Create createCmd = new Create();
+          createCmd.setCoreName(collection);
+          createCmd.setDataDir(getDataDir(createTempDir(collection).toFile().getAbsolutePath()));
+          client1.request(createCmd);
+        } catch (Exception e) {
+          e.printStackTrace();
+          //fails
         }
+        return null;
       };
      
       collectionClients.add(createNewSolrClient(collection, baseUrl));


Mime
View raw message