Commit 4854ff0b authored by Yann Mombrun's avatar Yann Mombrun

WEBLAB-1565 - Update of the code already written by lamartin in order to...

WEBLAB-1565 - Update of the code already written by lamartin in order to ensure that solr/zookeeper are both started before trying to reset

git-svn-id: svn://svn.forge.objectweb.org/svnroot/weblab/trunk/WebLabApplications/bundle@4576 a803c184-d8de-4a0e-a52b-d3eef88212b6
parent c45c38dc
......@@ -29,7 +29,6 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.commons.io.FileUtils;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.impl.CloudSolrClient;
import org.ow2.weblab.bundle.Constants;
import org.ow2.weblab.bundle.conf.WebLabBean;
......@@ -97,7 +96,8 @@ public class ServerManager {
logger.info(ServerManager.getServerDisplayedName(applicationServer) + " server status : NOT STARTED.");
}
}
private static final void displayStatus(final SolrServer solrServer, final Logger logger) {
if (!solrServer.isEnabled()) {
if (logger.isLoggable(Level.FINER)) {
......@@ -105,31 +105,31 @@ public class ServerManager {
}
return;
}
if (solrServer.isServerFullyStarted(true)) {
logger.info(ServerManager.getServerDisplayedName(solrServer) + " server status : READY");
//is this solr node the "main" one (the one we used to create inital collections)
HashMap<String, HashMap<String, String>> initCollections=solrServer.getInitCollections();
if(!CollectionUtils.isEmpty(initCollections)) {
final CloudSolrClient solrClient=solrServer.getSolrClient();
for(String collection : initCollections.keySet()) {
logger.info("Collection "+collection+" : READY");
final Map<String, List<String>> replicas=SolrUtils.getReplicas(solrClient, collection);
for(Entry<String, List<String>> entry : replicas.entrySet()) {
logger.info("\tNode "+entry.getKey());
for(String replica : entry.getValue()) {
logger.info("\t\tReplica "+replica+" READY");
// is this solr node the "main" one (the one we used to create inital collections)
HashMap<String, HashMap<String, String>> initCollections = solrServer.getInitCollections();
if (!CollectionUtils.isEmpty(initCollections)) {
final CloudSolrClient solrClient = solrServer.getSolrClient();
for (String collection : initCollections.keySet()) {
logger.info("\tCollection " + collection + " : READY");
final Map<String, List<String>> replicas = SolrUtils.getReplicas(solrClient, collection);
for (Entry<String, List<String>> entry : replicas.entrySet()) {
logger.info("\t\tNode " + entry.getKey());
for (String replica : entry.getValue()) {
logger.info("\t\t\tReplica " + replica + " READY");
}
}
}
}else {
logger.info("No solr collection available");
} else {
logger.info("No solr collection available");
}
} else {
logger.info(ServerManager.getServerDisplayedName(solrServer) + " server status : NOT STARTED.");
}
}
}
/**
......@@ -143,12 +143,12 @@ public class ServerManager {
for (final WebLabServer otherServer : this.configuration.getServers()) {
if (server == null || server.equals(otherServer.getName())) {
if(otherServer instanceof SolrServer) {
ServerManager.displayStatus((SolrServer)otherServer, this.logger);
}else {
if (otherServer instanceof SolrServer) {
ServerManager.displayStatus((SolrServer) otherServer, this.logger);
} else {
ServerManager.displayStatus(otherServer, this.logger);
}
this.logger.info("");
}
}
......@@ -156,24 +156,28 @@ public class ServerManager {
final TomcatServer tomcat = this.configuration.getApplicationServer();
tomcat.setTimeout(timeout);
ServerManager.displayStatus(tomcat, this.logger);
this.logger.info("");
}
if (server == null || server.equals(this.configuration.getPortal().getName())) {
final TomcatServer portal = this.configuration.getPortal();
portal.setTimeout(timeout);
ServerManager.displayStatus(portal, this.logger);
this.logger.info("");
}
if (server == null || server.equals(this.configuration.getBus().getName())) {
final Bus bus = this.configuration.getBus();
bus.setTimeout(timeout);
ServerManager.displayStatus(bus, this.logger);
this.logger.info("");
}
if (server == null || server.equals(this.configuration.getActiveMQServer().getName())) {
final ActiveMQServer activeMQServer = this.configuration.getActiveMQServer();
activeMQServer.setTimeout(timeout);
ServerManager.displayStatus(activeMQServer, this.logger);
this.logger.info("");
}
}
......@@ -415,7 +419,7 @@ public class ServerManager {
} else if (server != null && server.equals(this.configuration.getActiveMQServer().getName())) {
final ActiveMQServer activemq = this.configuration.getActiveMQServer();
if (!"purge".equals(command)) {
this.logger.warning("Command " + command + " is not supported on " + server +".");
this.logger.warning("Command " + command + " is not supported on " + server + ".");
} else {
activemq.purge(namedParameter);
}
......
......@@ -410,7 +410,7 @@ public class SolrServer extends AbstractApplicationServer {
* @return {@link CloudSolrClient} solr client used by this server
*/
public CloudSolrClient getSolrClient() {
return solrClient;
return this.solrClient;
}
/**
......
......@@ -171,7 +171,7 @@ public class TomcatServer extends WebLabServer {
final Map<String, String> webapps = getJMXClient(getTimeout()).getWebAppStatus();
for (final String context : webapps.keySet()) {
final String status = webapps.get(context);
final String result = "Web application " + context + " on " + getName() + " is " + status;
final String result = "\tWeb application " + context + " on " + getName() + " is " + status;
if (!"STARTED".equals(status)) {
started = false;
this.logger.warning(result);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment