public class Main {
private static final Log log = LogFactory.getLog(Main.class);
public static void main(String[] args) {
LoadBalancerExtension extension = null;
try {
// Configure log4j properties
PropertyConfigurator.configure(System.getProperty("log4j.properties.file.path"));
if (log.isInfoEnabled()) {
log.info("HAProxy extension started");
}
// Validate runtime parameters
HAProxyContext.getInstance().validate();
extension = new LoadBalancerExtension(new HAProxy(), (HAProxyContext.getInstance().isCEPStatsPublisherEnabled() ? new HAProxyStatisticsReader() : null));
Thread thread = new Thread(extension);
thread.start();
} catch (Exception e) {
if (log.isErrorEnabled()) {
log.error(e);
}
if (extension != null) {
extension.terminate();
}
}
}