Hi

The constructor of SolrZKClient has changed, I expect to ensure clean up of resources. The strategy is as follows:
connManager = new ConnectionManager(...)
try {
    ...
} catch (Throwable e) {
      connManager.close();
      throw new RuntimeException();
}
try {
  connManager.waitForConnected(clientConnectTimeout);
} catch (Throwable e) {
  connManager.close();
  throw new RuntimeException();
}

This results in a different exception (RuntimeException) returned from the constructor as earlier (nice exceptions as UnknownHostException, TimeoutException).

Can this be changed so we keep the old nice exceptions e.g. as follows (requiring the constructor to declare these) or at least include them as cause in the RuntimeException?

boolean closeBecauseOfException = true;
try {
    ...
   connManager.waitForConnected(clientConnectTimeout);
   closeBecauseOfException = false
} finally {
    if (closeBecauseOfException) {
        connManager.close();
    }
}

Any comments appreciated.

Best regards Trym

http://svn.apache.org/repos/asf/lucene/dev/branches/lucene_solr_4_0/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZkClient.java

Reply via email to