markusthoemmes commented on a change in pull request #2205: Add ability to
deploy a "hot-standby" controller
URL:
https://github.com/apache/incubator-openwhisk/pull/2205#discussion_r120804029
##########
File path:
core/controller/src/main/scala/whisk/core/controller/Controller.scala
##########
@@ -115,6 +117,7 @@ class Controller(
Collection.initialize(entityStore)
/** The REST APIs. */
+ implicit val controllerInstance = instance
Review comment:
Uh oh. Is this an implicit `Int`? You don't really want to do that, because
`Int` is such a generic type that by looking at the type annotations you have
no clue as to what is actually in the implicit scope. That's quite dangerous
and can lead to ambiguity really fast.
Instead you can define an enclosing value class, which won't get
instantiated on runtime but serves as a wrapper explicitly identifying what
you're talking about in the implicit scope.
```
class InstanceId(val instance: Int) extends AnyVal
```
The implicit will now be of type `InstanceId` which transports the meaning
that you want.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services