diff options
| author | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2017-09-29 14:03:06 +0200 |
|---|---|---|
| committer | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2017-09-29 14:40:48 +0200 |
| commit | a153e7abbb36594c27d918aa37dbf0fea17df3fe (patch) | |
| tree | a63e559fccf0ed28e82df5c03ba9cc92810a9aae /opendc-integration-jpa | |
| parent | d32b0a0046038770bd6e0fe4450407ad927392cb (diff) | |
Steamline Docker integration
This change improves the Docker integration by pre-building the
application when building the image to prevent having to build the
application at runtime.
Diffstat (limited to 'opendc-integration-jpa')
| -rw-r--r-- | opendc-integration-jpa/src/main/kotlin/nl/atlarge/opendc/platform/JpaExperiment.kt | 1 | ||||
| -rw-r--r-- | opendc-integration-jpa/src/main/kotlin/nl/atlarge/opendc/platform/JpaPlatformRunner.kt | 8 |
2 files changed, 8 insertions, 1 deletions
diff --git a/opendc-integration-jpa/src/main/kotlin/nl/atlarge/opendc/platform/JpaExperiment.kt b/opendc-integration-jpa/src/main/kotlin/nl/atlarge/opendc/platform/JpaExperiment.kt index 104011df..f5a86e64 100644 --- a/opendc-integration-jpa/src/main/kotlin/nl/atlarge/opendc/platform/JpaExperiment.kt +++ b/opendc-integration-jpa/src/main/kotlin/nl/atlarge/opendc/platform/JpaExperiment.kt @@ -145,5 +145,6 @@ class JpaExperiment(val manager: EntityManager, } logger.info { "Simulation done" } + manager.close() } } diff --git a/opendc-integration-jpa/src/main/kotlin/nl/atlarge/opendc/platform/JpaPlatformRunner.kt b/opendc-integration-jpa/src/main/kotlin/nl/atlarge/opendc/platform/JpaPlatformRunner.kt index d7282c27..6a1d839d 100644 --- a/opendc-integration-jpa/src/main/kotlin/nl/atlarge/opendc/platform/JpaPlatformRunner.kt +++ b/opendc-integration-jpa/src/main/kotlin/nl/atlarge/opendc/platform/JpaPlatformRunner.kt @@ -38,9 +38,15 @@ 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 threads = 1 val executorService = Executors.newFixedThreadPool(threads) - val factory = Persistence.createEntityManagerFactory("opendc-simulator") val experiments = JpaExperimentManager(factory) logger.info { "Waiting for enqueued experiments..." } |
