You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by ra...@apache.org on 2018/09/24 16:49:59 UTC
[incubator-openwhisk] branch master updated: Move container-config
to singleton so it is loaded only once. (#4038)
This is an automated email from the ASF dual-hosted git repository.
rabbah pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk.git
The following commit(s) were added to refs/heads/master by this push:
new 395ca17 Move container-config to singleton so it is loaded only once. (#4038)
395ca17 is described below
commit 395ca17b21fb20549633444cf8dfe1a74ccab374
Author: Christian Bickel <gi...@cbickel.de>
AuthorDate: Mon Sep 24 18:49:53 2018 +0200
Move container-config to singleton so it is loaded only once. (#4038)
---
.../scala/src/main/scala/whisk/core/containerpool/Container.scala | 7 +++----
.../scala/whisk/core/containerpool/docker/DockerContainer.scala | 2 +-
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/common/scala/src/main/scala/whisk/core/containerpool/Container.scala b/common/scala/src/main/scala/whisk/core/containerpool/Container.scala
index 1dfe66a..3167176 100644
--- a/common/scala/src/main/scala/whisk/core/containerpool/Container.scala
+++ b/common/scala/src/main/scala/whisk/core/containerpool/Container.scala
@@ -58,6 +58,8 @@ object Container {
*/
val ACTIVATION_LOG_SENTINEL = "XXX_THE_END_OF_A_WHISK_ACTIVATION_XXX"
+ protected[containerpool] val config: ContainerPoolConfig =
+ loadConfigOrThrow[ContainerPoolConfig](ConfigKeys.containerPool)
}
trait Container {
@@ -68,9 +70,6 @@ trait Container {
protected implicit val logging: Logging
protected implicit val ec: ExecutionContext
- protected[containerpool] val config: ContainerPoolConfig =
- loadConfigOrThrow[ContainerPoolConfig](ConfigKeys.containerPool)
-
/** HTTP connection to the container, will be lazily established by callContainer */
protected var httpConnection: Option[ContainerClient] = None
@@ -182,7 +181,7 @@ trait Container {
implicit transid: TransactionId): Future[RunResult] = {
val started = Instant.now()
val http = httpConnection.getOrElse {
- val conn = if (config.akkaClient) {
+ val conn = if (Container.config.akkaClient) {
new AkkaContainerClient(addr.host, addr.port, timeout, ActivationEntityLimit.MAX_ACTIVATION_ENTITY_LIMIT, 1024)
} else {
new ApacheBlockingContainerClient(
diff --git a/core/invoker/src/main/scala/whisk/core/containerpool/docker/DockerContainer.scala b/core/invoker/src/main/scala/whisk/core/containerpool/docker/DockerContainer.scala
index 538e367..47b6d24 100644
--- a/core/invoker/src/main/scala/whisk/core/containerpool/docker/DockerContainer.scala
+++ b/core/invoker/src/main/scala/whisk/core/containerpool/docker/DockerContainer.scala
@@ -204,7 +204,7 @@ class DockerContainer(protected val id: ContainerId,
implicit transid: TransactionId): Future[RunResult] = {
val started = Instant.now()
val http = httpConnection.getOrElse {
- val conn = if (config.akkaClient) {
+ val conn = if (Container.config.akkaClient) {
new AkkaContainerClient(addr.host, addr.port, timeout, ActivationEntityLimit.MAX_ACTIVATION_ENTITY_LIMIT, 1024)
} else {
new ApacheBlockingContainerClient(