- logger.info("Self registration started");
- try {
- selfRegistrationManager.register();
- logger.info("Self registration finished");
- } catch (RuntimeException e) {
- logger.error("Self registration failed", e);
- throw e;
- }
+ Callable<Boolean> singleRegistration = () -> {
+ logger.info("Self registration started");
+ try {
+ selfRegistrationManager.register();
+ logger.info("Self registration finished");
+ } catch (RuntimeException e) {
+ logger.error("Self registration failed", e);
+ throw e;
+ }
+ return true;
+ };
+ executorService.submit(() -> {
+ while(!jobManager.isPreparingForShutDown()){
+ try{
+ executorService.submit(singleRegistration).get();
+ //registration successful
+ return;
+ }
+ catch (Exception e){
+ logger.warn("Unable to execute self registration process", e);
+ }
+ systemFunctions().sleep(5000);
+ }
+ });