@Override
public void run() {
while (kieServerActive.get()) {
try {
logger.debug("Attempting to connect to one of the controllers...");
KieServerSetup kieServerSetup = kieController.connect(kieServerInfo);
logger.debug("Connected to controller and retrieved setup details {}", kieServerSetup);
Set<KieContainerResource> containers = startupStrategy.prepareContainers(kieServerSetup.getContainers());
kieServer.addServerStatusMessage(kieServerInfo);
containerManager.installContainers(kieServer, containers, currentState, kieServerSetup);
break;
} catch (KieControllerNotConnectedException e) {
long waitTime = Long.parseLong(System.getProperty(KieServerConstants.CFG_KIE_SERVER_CONTROLLER_CONNECT_INTERVAL, "10000"));
logger.debug("Still cannot connect to any controllers, waiting for {} before next attempt", waitTime);
try {
Thread.sleep(waitTime);
} catch (InterruptedException e1) {
logger.warn("Controller connect thread got interrupted");
}
}
}
logger.info("Connected to controller, quiting connector thread");
}
}