[Minor] Code cleanup

This commit is contained in:
Robert von Burg 2016-10-03 14:00:39 +02:00
parent 61b3a3e5bf
commit 597441653a
3 changed files with 35 additions and 27 deletions

View File

@ -37,16 +37,20 @@ public class StartupListener implements ServletContextListener {
@Override
public void contextInitialized(ServletContextEvent sce) {
try {
String realPath = sce.getServletContext().getRealPath("/WEB-INF");
String realPath = sce.getServletContext().getRealPath("/WEB-INF");
File pathF = new File(realPath);
String environment = StrolchEnvironment.getEnvironmentFromEnvProperties(pathF);
logger.info("Starting Agent...");
this.agent = new StrolchBootstrapper(StartupListener.class).setupByRoot(environment, pathF);
this.agent.initialize();
this.agent.start();
logger.info("Agent started.");
File pathF = new File(realPath);
String environment = StrolchEnvironment.getEnvironmentFromEnvProperties(pathF);
logger.info("Starting Agent...");
this.agent = new StrolchBootstrapper(StartupListener.class).setupByRoot(environment, pathF);
this.agent.initialize();
this.agent.start();
logger.info("Agent started.");
} catch (Exception e) {
logger.error("Server startup failed due to: " + e.getMessage(), e);
throw e;
}
}
@Override

View File

@ -37,16 +37,20 @@ public class StartupListener implements ServletContextListener {
@Override
public void contextInitialized(ServletContextEvent sce) {
try {
String realPath = sce.getServletContext().getRealPath("/WEB-INF");
String realPath = sce.getServletContext().getRealPath("/WEB-INF");
File pathF = new File(realPath);
String environment = StrolchEnvironment.getEnvironmentFromEnvProperties(pathF);
logger.info("Starting Agent...");
this.agent = new StrolchBootstrapper(StartupListener.class).setupByRoot(environment, pathF);
this.agent.initialize();
this.agent.start();
logger.info("Agent started.");
File pathF = new File(realPath);
String environment = StrolchEnvironment.getEnvironmentFromEnvProperties(pathF);
logger.info("Starting Agent...");
this.agent = new StrolchBootstrapper(StartupListener.class).setupByRoot(environment, pathF);
this.agent.initialize();
this.agent.start();
logger.info("Agent started.");
} catch (Exception e) {
logger.error("Server startup failed due to: " + e.getMessage(), e);
throw e;
}
}
@Override

View File

@ -22,22 +22,22 @@ public class StartupListener implements ServletContextListener {
@Override
public void contextInitialized(ServletContextEvent sce) {
String realPath = sce.getServletContext().getRealPath("/WEB-INF");
File pathF = new File(realPath);
String environment = StrolchEnvironment.getEnvironmentFromEnvProperties(pathF);
logger.info("Starting Strolch Minimal Rest...");
try {
String realPath = sce.getServletContext().getRealPath("/WEB-INF");
File pathF = new File(realPath);
String environment = StrolchEnvironment.getEnvironmentFromEnvProperties(pathF);
logger.info("Starting Strolch Minimal Rest...");
this.agent = new StrolchBootstrapper(StartupListener.class).setupByRoot(environment, pathF);
this.agent.initialize();
this.agent.start();
logger.info("Started Strolch Minimal Rest.");
} catch (Exception e) {
logger.error("Failed to start Strolch due to: " + e.getMessage(), e);
logger.error("Server startup failed due to: " + e.getMessage(), e);
throw e;
}
logger.info("Started Strolch Minimal Rest.");
}
@Override