You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2012/01/11 01:58:38 UTC
svn commit: r1229838 - in
/lucene/dev/branches/solrcloud/solr/solrj/src/java/org/apache/solr/common/cloud:
DefaultConnectionStrategy.java SolrZkClient.java
Author: markrmiller
Date: Wed Jan 11 00:58:38 2012
New Revision: 1229838
URL: http://svn.apache.org/viewvc?rev=1229838&view=rev
Log:
we dont actually need these retries
Modified:
lucene/dev/branches/solrcloud/solr/solrj/src/java/org/apache/solr/common/cloud/DefaultConnectionStrategy.java
lucene/dev/branches/solrcloud/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZkClient.java
Modified: lucene/dev/branches/solrcloud/solr/solrj/src/java/org/apache/solr/common/cloud/DefaultConnectionStrategy.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/solrj/src/java/org/apache/solr/common/cloud/DefaultConnectionStrategy.java?rev=1229838&r1=1229837&r2=1229838&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/solrj/src/java/org/apache/solr/common/cloud/DefaultConnectionStrategy.java (original)
+++ lucene/dev/branches/solrcloud/solr/solrj/src/java/org/apache/solr/common/cloud/DefaultConnectionStrategy.java Wed Jan 11 00:58:38 2012
@@ -18,9 +18,6 @@ package org.apache.solr.common.cloud;
*/
import java.io.IOException;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import org.apache.zookeeper.SolrZooKeeper;
@@ -34,7 +31,6 @@ import org.slf4j.LoggerFactory;
public class DefaultConnectionStrategy extends ZkClientConnectionStrategy {
private static Logger log = LoggerFactory.getLogger(DefaultConnectionStrategy.class);
- private ScheduledExecutorService executor;
@Override
public void connect(String serverAddress, int timeout, Watcher watcher, ZkUpdate updater) throws IOException, InterruptedException, TimeoutException {
@@ -44,32 +40,17 @@ public class DefaultConnectionStrategy e
@Override
public void reconnect(final String serverAddress, final int zkClientTimeout,
final Watcher watcher, final ZkUpdate updater) throws IOException {
- log.info("Starting reconnect to ZooKeeper attempts ...");
- executor = Executors.newScheduledThreadPool(1);
- executor.schedule(new Runnable() {
- private int delay = 1000;
- public void run() {
- log.info("Attempting the connect...");
- boolean connected = false;
- try {
- updater.update(new SolrZooKeeper(serverAddress, zkClientTimeout, watcher));
- log.info("Reconnected to ZooKeeper");
- connected = true;
- } catch (Exception e) {
- log.error("", e);
- log.info("Reconnect to ZooKeeper failed");
- }
- if(connected) {
- executor.shutdownNow();
- } else {
- if(delay < 240000) {
- delay = delay * 2;
- }
- executor.schedule(this, delay, TimeUnit.MILLISECONDS);
- }
-
- }
- }, 1000, TimeUnit.MILLISECONDS);
+ log.info("Connection expired - starting a new one...");
+
+ try {
+ updater
+ .update(new SolrZooKeeper(serverAddress, zkClientTimeout, watcher));
+ log.info("Reconnected to ZooKeeper");
+ } catch (Exception e) {
+ log.error("", e);
+ log.info("Reconnect to ZooKeeper failed");
+ }
+
}
}
Modified: lucene/dev/branches/solrcloud/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZkClient.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZkClient.java?rev=1229838&r1=1229837&r2=1229838&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZkClient.java (original)
+++ lucene/dev/branches/solrcloud/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZkClient.java Wed Jan 11 00:58:38 2012
@@ -141,7 +141,6 @@ public class SolrZkClient {
}
});
connManager.waitForConnected(clientConnectTimeout);
- // TODO: if we cannot connect initially, stop connect retries from happening...
}
/**