Actuator health endpoint #2
|
@ -20,7 +20,7 @@ public class SolrStartupHealthCheck implements ApplicationRunner {
|
|||
private SolrRepository solrRepository;
|
||||
|
||||
@Override
|
||||
public void run(ApplicationArguments args) throws Exception {
|
||||
public void run(ApplicationArguments args) throws RuntimeException {
|
||||
try {
|
||||
if (solrRepository.ping().getStatus() != 0) {
|
||||
throw new RuntimeException("Could not ping Solr cluster at startup");
|
||||
|
|
|
@ -43,16 +43,15 @@ public class SolrConnectionManager {
|
|||
// create SolrClient with ZooKeeper hosts
|
||||
// TODO: add socket (or connection) timeout?
|
||||
solrClient = new CloudSolrClient.Builder(zkHosts, Optional.empty())
|
||||
.withConnectionTimeout(15000)
|
||||
.withSocketTimeout(1000)
|
||||
// time to wait when trying to establish a connection
|
||||
.withConnectionTimeout(3000)
|
||||
// time to wait for data to be read from the socket
|
||||
.withSocketTimeout(30000)
|
||||
.build();
|
||||
|
||||
// set the appropriate Solr collection
|
||||
((CloudSolrClient) solrClient).setDefaultCollection(solrProperties.getCollection());
|
||||
|
||||
// uncomment ping below, to crash app on startup if Solr is not available
|
||||
// this.ping();
|
||||
|
||||
}
|
||||
|
||||
public SolrPingResponse ping() throws IOException, SolrServerException {
|
||||
|
|
Loading…
Reference in New Issue