Differences

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

Link to this comparison view

irc:1432332000 [2017/05/27 13:44] (current)
Line 1: Line 1:
 +[15:18:59] <​spriet2000>​ hi
 +
 +[15:19:14] <​AlexLehm>​ hi
 +
 +[15:19:17] <​spriet2000>​ what's a good approach for doing a number x of async methods, wait till all methods have returned something and do something else with the collected values?
 +
 +[15:19:56] <​spriet2000>​ its all local so evenbus isn't necessary
 +
 +[15:21:13] <​AlexLehm>​ you could use rx I think
 +
 +[15:21:44] <​spriet2000>​ but it should be possible with core object also right?
 +
 +[15:22:22] <​AlexLehm>​ you can probably use Future and combine them in some way
 +
 +[15:22:58] <​spriet2000>​ yea i am learning how to deal with futures and async results
 +
 +[15:23:08] <​AlexLehm>​ e.g. put them in a Concurrent Set and count the number of completed elements
 +
 +[15:23:52] <​AlexLehm>​ I have a close operation in the connection pool that counts down the number of open connections and removes them from the map
 +
 +[15:24:16] <​AlexLehm>​ you could do about the same thing by counting up to the size of the map
 +
 +[15:24:42] <​AlexLehm>​ or Set
 +
 +[15:24:53] <​spriet2000>​ now i have something like https://​github.com/​spriet2000/​vertx-handlers-http-api/​blob/​master/​src/​main/​java/​vertx/​handlers/​http/​api/​binding/​impl/​DefaultBindingContext.java
 +
 +[15:25:03] <​spriet2000>​ which doesnt work
 +
 +[15:25:23] <​spriet2000>​ but i am figuring out how to handle future stuff
 +
 +[15:25:53] <​spriet2000>​ concurrent map is probarly better than a list
 +
 +[15:26:25] <​spriet2000>​ a future isnt executed async automaticly right?
 +
 +[15:28:58] <​AlexLehm>​ the future can be executed async but you cannot wait for the completion syncchronous
 +
 +[15:29:05] <​AlexLehm>​ (i think)
 +
 +[15:29:18] <​spriet2000>​ exactly that will block
 +
 +[15:29:49] <​AlexLehm>​ but Future has a handler, do you can process the result with that
 +
 +[15:30:18] <​spriet2000>​ yeps
 +
 +[15:37:55] <​spriet2000>​ if you want to process a couple of methods at the same time what is the correct way to start them? is http://​vertx.io/​api/​java/​org/​vertx/​java/​core/​Vertx.html#​runOnContext(org.vertx.java.core.Handler) invented for that kind of situations?
 +
 +[17:21:44] <​spriet2000>​ future is nice!
 +
 +[17:48:44] <​AlexLehm>​ tekacs,
 +
 +[17:48:46] <​AlexLehm>​ sorry
 +
 +[17:49:25] <​tekacs>​ autocomplete?​ :P
 +
 +[17:49:52] <​AlexLehm>​ yes, i meant to address temporalfox
 +
 +[17:50:35] <​AlexLehm>​ temporalfox,​ when i use codegen on a package it generates the files for the classes that are not included in the source but are references as project, not sure if that is correct
 +
 +[17:51:17] <​AlexLehm>​ spriet2000, haven'​t used Future much yet, but that should make joining a few results easy
 +
 +[18:27:07] <​temporalfox>​ AlexLehm I don't understand what you mean :-)
 +
 +[18:27:23] <​temporalfox>​ you mean dependencies ?
 +
 +[18:27:30] <​temporalfox>​ do you have an example ?
 +
 +[18:27:54] <​AlexLehm>​ we have refactored the mail project into two maven modules, vertx-mail-client and vertx-mail-service and service depends on client
 +
 +[18:28:13] <​AlexLehm>​ now the codegen generates the files for client in the service project once more
 +
 +[18:30:20] <​AlexLehm>​ https://​vertx.ci.cloudbees.com/​job/​vert.x3-mail-client-wip/​ws/​vertx-mail-service/​src/​main/​resources/​vertx-mail/​
 +
 +[18:30:38] <​AlexLehm>​ i may be calling the process wrong though
 +
 +[18:31:04] <​AlexLehm>​ I would expect that only the mail_service.rb would be generated in this case
 +
 +[18:36:35] <​spriet2000>​ i have it working now :>
 +
 +[18:36:46] <​spriet2000>​ thanks
 +
 +[18:41:10] <​spriet2000>​ although i still have questions about runoncontext why and when to use and if its expensive in use[unknown:​hellip] but thats for later
 +
 +[19:00:06] <​temporalfox>​ I will have a look AlexLehm
 +
 +[19:00:34] <​temporalfox>​ I don'​treally get why we had to split in two modules though
 +
 +[19:02:10] <​AlexLehm>​ i assume to avoid getting the dependencies on the proxy when it is not used
 +
 +[19:54:42] <​AlexLehm>​ what is the best way to store state in a variable when accessing it via a lambda block in a test? I am currently using AtomicInteger and AtomicBoolean,​ but its probably that is too complicated
 +
 +[19:54:57] <​AlexLehm>​ and AtomicReference for String