Differences

This shows you the differences between two versions of the page.

Link to this comparison view

irc:1465077600 [2017/05/27 13:44] (current)
Line 1: Line 1:
 +[14:42:21] *** ChanServ sets mode: +o temporal_
 +
 +[17:30:22] <​Yakabu>​ Hi. Is it possible to stop a verticle from within the verticle itself?
 +
 +[18:29:36] *** ChanServ sets mode: +o temporalfox
 +
 +[18:30:26] <​Yakabu>​ Hi. Is it possible to terminate a verticle from within the verticle itself?
 +
 +[18:39:07] <​Sticky>​ Yakabu: what happens when you try?
 +
 +[18:40:44] <​Yakabu>​ Sticky: "​Try"?​ The only thing I can try to do is terminate the entire vert.x instance
 +
 +[18:41:01] <​Yakabu>​ I want to simply stop a single verticle
 +
 +[18:41:23] <​Yakabu>​ From within the verticle itself, so it stops itself
 +
 +[18:41:25] <​Sticky>​ http://​vertx.io/​docs/​apidocs/​io/​vertx/​core/​Vertx.html#​undeploy-java.lang.String-
 +
 +[18:41:51] <​Yakabu>​ Can I get the deploymentId from within the verticle?
 +
 +[18:42:14] <​Sticky>​ I believe vertx.getOrCreateContext().deploymentID() should be it
 +
 +[18:43:07] <​Sticky>​ or context.deploymentID() from within the init method
 +
 +[18:43:52] <​Yakabu>​ oh!
 +
 +[18:43:54] <​Yakabu>​ thanks :)
 +
 +[18:44:00] <​Yakabu>​ I'll try it now
 +
 +[18:51:48] <​Yakabu>​ hmm
 +
 +[18:51:59] <​Yakabu>​ I get this exception: java.lang.IllegalStateException:​ Unknown deployment
 +
 +[18:54:27] <​Yakabu>​ Weird because vertx.getOrCreateContext().deploymentID() isn't returning null...It'​s giving me a deployment ID
 +
 +[18:54:39] <​Yakabu>​ Why doesn'​t this work?
 +
 +[18:55:45] <​Yakabu>​ http://​pastebin.com/​bwsjyCBn
 +
 +[18:55:50] <​Yakabu>​ That's the code I'm using to undeploy
 +
 +[19:04:20] <​Yakabu>​ Sticky: Any ideas?
 +
 +[19:04:52] <​Sticky>​ maybe it is not returning the correct deployment id, does it agree with the id returned from the deploy method?
 +
 +[19:05:20] <​Sticky>​ and where are you putting that code in?
 +
 +[19:06:17] <​Yakabu>​ I'm putting that code in a closeHandler of a NetSocket
 +
 +[19:07:33] <​Yakabu>​ Checking if it agrees with the id from deploy method 2 secs
 +
 +[19:09:50] <​Yakabu>​ Hmm
 +
 +[19:10:04] <​Yakabu>​ Ok it deploys successfully but code is still running
 +
 +[19:10:38] <​Yakabu>​ I have a method that calls itself recursively through a timer
 +
 +[19:10:46] <​Yakabu>​ Shouldn'​t that stop once the verticle is undeployed?
 +
 +[19:10:54] <​Sticky>​ probably not
 +
 +[19:11:04] <​Sticky>​ not sure about that though
 +
 +[19:11:13] <​Yakabu>​ What exactly does undeploying do then?
 +
 +[19:11:39] <​Yakabu>​ Not much info in the docs
 +
 +[19:13:07] <​Yakabu>​ "​Automatic clean-up in verticles ​ If you[unknown:​rsquo]re creating timers from inside verticles, those timers will be automatically closed when the verticle is undeployed."​
 +
 +[19:13:21] <​Yakabu>​ from http://​vertx.io/​docs/​vertx-core/​java/​
 +
 +[19:13:55] <​Sticky>​ hmm, ok, not sure what it would be then
 +
 +[19:14:27] <​Yakabu>​ Hmm when it says "​closed"​ does that mean it just fires the timer event
 +
 +[19:19:22] <​Yakabu>​ Got it working! Thanks Sticky :')
 +
 +[20:02:01] <​BadApe>​ is there a date that version 3.3 will be out?
 +
 +[20:24:14] <​Yakabu>​ BadApe: Early june according to this https://​github.com/​vert-x3/​wiki/​wiki/​Vert.x-Roadmap
 +
 +[20:24:23] <​Yakabu>​ so very soon most likely
 +
 +[21:31:48] <​BadApe>​ cool! :D
 +
 +[21:32:01] <​BadApe>​ oh http/2 support