summaryrefslogtreecommitdiff
path: root/opendc-model-odc/setup/src/main/kotlin
diff options
context:
space:
mode:
Diffstat (limited to 'opendc-model-odc/setup/src/main/kotlin')
-rw-r--r--opendc-model-odc/setup/src/main/kotlin/platform/JpaPlatformRunner.kt42
1 files changed, 21 insertions, 21 deletions
diff --git a/opendc-model-odc/setup/src/main/kotlin/platform/JpaPlatformRunner.kt b/opendc-model-odc/setup/src/main/kotlin/platform/JpaPlatformRunner.kt
index 3f0fe589..8fe49844 100644
--- a/opendc-model-odc/setup/src/main/kotlin/platform/JpaPlatformRunner.kt
+++ b/opendc-model-odc/setup/src/main/kotlin/platform/JpaPlatformRunner.kt
@@ -39,28 +39,28 @@ val logger = KotlinLogging.logger {}
* @param args The command line arguments of the program.
*/
fun main(args: Array<String>) {
- val properties = HashMap<Any, Any>()
- val env = System.getenv()
- properties["javax.persistence.jdbc.url"] = env["PERSISTENCE_URL"] ?: ""
- properties["javax.persistence.jdbc.user"] = env["PERSISTENCE_USER"] ?: ""
- properties["javax.persistence.jdbc.password"] = env["PERSISTENCE_PASSWORD"] ?: ""
- val factory = Persistence.createEntityManagerFactory("opendc-simulator", properties)
+ val properties = HashMap<Any, Any>()
+ val env = System.getenv()
+ properties["javax.persistence.jdbc.url"] = env["PERSISTENCE_URL"] ?: ""
+ properties["javax.persistence.jdbc.user"] = env["PERSISTENCE_USER"] ?: ""
+ properties["javax.persistence.jdbc.password"] = env["PERSISTENCE_PASSWORD"] ?: ""
+ val factory = Persistence.createEntityManagerFactory("opendc-simulator", properties)
- val timeout = 10000L
- val threads = 4
- val executorService = Executors.newFixedThreadPool(threads)
- val experiments = JpaExperimentManager(factory)
- val kernel = OmegaKernelFactory
+ val timeout = 10000L
+ val threads = 4
+ val executorService = Executors.newFixedThreadPool(threads)
+ val experiments = JpaExperimentManager(factory)
+ val kernel = OmegaKernelFactory
- logger.info { "Waiting for enqueued experiments..." }
- while (true) {
- experiments.poll()?.let { experiment ->
- logger.info { "Found experiment. Submitting for simulation now..." }
- executorService.submit {
- experiment.use { it.run(kernel, timeout) }
- }
- }
+ logger.info { "Waiting for enqueued experiments..." }
+ while (true) {
+ experiments.poll()?.let { experiment ->
+ logger.info { "Found experiment. Submitting for simulation now..." }
+ executorService.submit {
+ experiment.use { it.run(kernel, timeout) }
+ }
+ }
- Thread.sleep(500)
- }
+ Thread.sleep(500)
+ }
}