Join Slack
Powered by
Should I to keep a global reference to vertx objec...
# vertx
f
fstn
10/15/2017, 1:30 PM
Should I to keep a global reference to vertx object or use Vertx.vertx() every where?
fstn
10/15/2017, 2:52 PM
After some search, it seems that the good solution is to keep a vertx reference
n
napperley
10/16/2017, 1:40 AM
Will depend on your situation however it is a bad idea to have a global ref to Vertx. Have a look at this example (
https://github.com/napperley/vertx-kotlintest/blob/master/src/test/kotlin/org/digieng/vertx/kotlintest/HttpClientExtensionsTest.kt
) for a situation where Vert.x code is being tested.
👍 1
f
fstn
10/16/2017, 3:31 AM
mmm in this example, it use the Abstract Verticle for provide vertx. So have a new Vertx inside each Verticle is great
11
Views
Open in Slack
Previous
Next