diff --git a/src/main/java/ch/ethz/seb/sebserver/gbl/async/AsyncServiceSpringConfig.java b/src/main/java/ch/ethz/seb/sebserver/gbl/async/AsyncServiceSpringConfig.java index 367187da..4f750ff1 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gbl/async/AsyncServiceSpringConfig.java +++ b/src/main/java/ch/ethz/seb/sebserver/gbl/async/AsyncServiceSpringConfig.java @@ -66,7 +66,7 @@ public class AsyncServiceSpringConfig implements AsyncConfigurer { public Executor examAPIPingThreadPoolTaskExecutor() { final ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); executor.setCorePoolSize(10); - executor.setMaxPoolSize(20); + executor.setMaxPoolSize(100); executor.setQueueCapacity(0); executor.setThreadNamePrefix("SEBPingService-"); executor.initialize(); diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/SEBServerMigrationStrategy.java b/src/main/java/ch/ethz/seb/sebserver/webservice/SEBServerMigrationStrategy.java index d50caf2c..6e9fd653 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/SEBServerMigrationStrategy.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/SEBServerMigrationStrategy.java @@ -73,7 +73,7 @@ public class SEBServerMigrationStrategy implements FlywayMigrationStrategy { SEBServerInit.INIT_LOGGER.info("----> Found pending migrations: {}", pendingMigrations.length); // If we are in a distributed setup only apply migration task if this is the master service // or if there was no data base initialization yet at all. - if (this.webserviceInfo.isDistributed()) { + if (this.webserviceInfo.isDistributed() && this.webserviceInfoDAO.isInitialized()) { SEBServerInit.INIT_LOGGER.info("----> This is distributed setup, check master..."); diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/WebserviceInit.java b/src/main/java/ch/ethz/seb/sebserver/webservice/WebserviceInit.java index 03043afe..b863ca27 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/WebserviceInit.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/WebserviceInit.java @@ -78,21 +78,24 @@ public class WebserviceInit implements ApplicationListener "); SEBServerInit.INIT_LOGGER.info("----> Register Webservice: {}", this.webserviceInfo.getWebserviceUUID()); - try { - final boolean register = this.webserviceInfoDAO.register( - this.webserviceInfo.getWebserviceUUID(), - InetAddress.getLocalHost().getHostAddress()); - if (register) { - SEBServerInit.INIT_LOGGER.info("----> Successfully register Webservice instance"); - } - } catch (final Exception e) { - SEBServerInit.INIT_LOGGER.error("----> Failed to register webservice: ", e); - } + if (this.webserviceInfoDAO.isInitialized()) { + this.registerWebservice(); - // Apply migration if needed and possible - SEBServerInit.INIT_LOGGER.info("----> "); - this.sebServerMigrationStrategy.applyMigration(); - SEBServerInit.INIT_LOGGER.info("----> "); + // Apply migration if needed and possible + SEBServerInit.INIT_LOGGER.info("----> "); + this.sebServerMigrationStrategy.applyMigration(); + SEBServerInit.INIT_LOGGER.info("----> "); + + } else { + + // Apply migration if needed and possible + SEBServerInit.INIT_LOGGER.info("----> "); + this.sebServerMigrationStrategy.applyMigration(); + SEBServerInit.INIT_LOGGER.info("----> "); + + this.registerWebservice(); + + } SEBServerInit.INIT_LOGGER.info("----> "); SEBServerInit.INIT_LOGGER.info("----> Initialize Services..."); @@ -155,6 +158,22 @@ public class WebserviceInit implements ApplicationListener *********************************************************"); } + private boolean registerWebservice() { + boolean registered = false; + try { + final String webserviceUUID = this.webserviceInfo.getWebserviceUUID(); + final String hostAddress = InetAddress.getLocalHost().getHostAddress(); + registered = this.webserviceInfoDAO.register(webserviceUUID, hostAddress); + if (registered) { + SEBServerInit.INIT_LOGGER.info("----> Successfully register Webservice instance. uuid: {}, address: {}", + webserviceUUID, hostAddress); + } + } catch (final Exception e) { + SEBServerInit.INIT_LOGGER.error("----> Failed to register webservice: ", e); + } + return registered; + } + @PreDestroy public void gracefulShutdown() { SEBServerInit.INIT_LOGGER.info("*********************************************************"); diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ExamSessionControlTask.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ExamSessionControlTask.java index 6d939cac..5aa76dd7 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ExamSessionControlTask.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ExamSessionControlTask.java @@ -115,12 +115,12 @@ public class ExamSessionControlTask implements DisposableBean { updateMaster(); - this.sebClientConnectionService.updatePingEvents(); - if (!this.webserviceInfo.isMaster()) { return; } + this.sebClientConnectionService.updatePingEvents(); + if (log.isTraceEnabled()) { log.trace("Run exam session update task"); }