SOLR-3532 add shutdown to SolrServer

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1349127 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sami Siren 2012-06-12 05:45:09 +00:00
parent 25a59d8902
commit 40c18680ab
8 changed files with 15 additions and 3 deletions

View File

@ -252,6 +252,7 @@ public class EmbeddedSolrServer extends SolrServer
/**
* Shutdown all cores within the EmbeddedSolrServer instance
*/
@Override
public void shutdown() {
coreContainer.shutdown();
}

View File

@ -752,7 +752,7 @@ public class BasicDistributedZkTest extends AbstractDistributedZkTestCase {
public void tearDown() throws Exception {
super.tearDown();
if (solrj != null) {
solrj.close();
solrj.shutdown();
}
System.clearProperty("zkHost");
}

View File

@ -1320,7 +1320,7 @@ public class FullSolrCloudTest extends AbstractDistributedZkTestCase {
}
((HttpSolrServer) controlClient).shutdown();
if (cloudClient != null) {
cloudClient.close();
cloudClient.shutdown();
}
if (zkStateReader != null) {
zkStateReader.close();

View File

@ -365,4 +365,11 @@ public abstract class SolrServer implements Serializable
}
return binder;
}
/**
* Release allocated resources.
*
* @since solr 4.0
*/
public abstract void shutdown();
}

View File

@ -197,7 +197,8 @@ public class CloudSolrServer extends SolrServer {
return rsp.getResponse();
}
public void close() {
@Override
public void shutdown() {
if (zkStateReader != null) {
synchronized(this) {
if (zkStateReader!= null)

View File

@ -354,6 +354,7 @@ public class ConcurrentUpdateSolrServer extends SolrServer {
log.error("error", ex);
}
@Override
public void shutdown() {
server.shutdown();
scheduler.shutdown();

View File

@ -579,6 +579,7 @@ public class HttpSolrServer extends SolrServer {
/**
* Close the {@link ClientConnectionManager} from the internal client.
*/
@Override
public void shutdown() {
if (httpClient != null && internalClient) {
httpClient.getConnectionManager().shutdown();

View File

@ -398,6 +398,7 @@ public class LBHttpSolrServer extends SolrServer {
HttpClientUtil.setSoTimeout(httpClient, timeout);
}
@Override
public void shutdown() {
if (aliveCheckExecutor != null) {
aliveCheckExecutor.shutdownNow();