This version (2017/05/27 13:44) is a draft.
Approvals: 0/1

[11:46:26] <Lone_Rifle> Hello - i was browsing the source and i noticed that many of the getLocalXXX methods are implemented as follows:

[11:47:18] <Lone_Rifle> Foo f = new Foo(vertx); Foo prev = localFoos.putIfAbsent(name, f); if (prev != null) f = prev; return f;

[11:48:28] <Lone_Rifle> I would like to send in a PR which basically reduces the pattern to Foo f = localFoos.computeIfAbsent(name, n → new Foo(vertx)); return f

[11:49:42] <Lone_Rifle> I believe this is the intent of the original authors where we atomically determine whether a Foo of name has been created, and if it isn't, we do so. The pattern i propose alllows us to avoid unnecessary object creation with each get

[11:49:53] <Lone_Rifle> I'm open to feedback though, so what do you think?

[11:50:12] <Lone_Rifle> …. oh sorry, many of the SharedDataImpl.getLocalXXX methods.

[13:25:33] *** ChanServ sets mode: +o temporalfox

[13:27:10] <Lone_Rifle> hello temporalfox - i had a query earlier about the implementation of SharedDataImpl.getLocalXXX if you are happy to spare some time on the question

[13:27:43] <temporalfox> hi Lone_Rifle

[13:27:52] <temporalfox> sure I can try to help

[13:28:27] <Lone_Rifle> i've noticed that most of them take the pattern Foo f = new Foo(vertx); Foo prev = localFoos.putIfAbsent(name, f); if (prev != null) f = prev; return f;

[13:29:17] <Lone_Rifle> i was thinking of sending a PR to change them to fit the pattern Foo f = localFoos.computeIfAbsent(name, createSinceMissing); return f;

[13:29:50] <temporalfox> is it the same ?

[13:30:31] <Lone_Rifle> it is, with the additional benefit of creating a spurious Foo with each call

[13:30:41] <Lone_Rifle> er, s/creating/avoiding the creation of/

[13:31:18] <Lone_Rifle> at the same time we retain the atomic population of the map

[13:32:10] <temporalfox> and it in term of concurrency it is the same ?

[13:32:16] <temporalfox> I'm assuming

[13:34:40] <Lone_Rifle> the critical section will extend over object creation if the map doesn't have the value, so there's a slight difference

[13:34:44] <Lone_Rifle> the semantics remain the same though

[13:41:31] <Lone_Rifle> temporalfox: I'll send the PR in over the coming days. Thanks for hearing me out!

[21:26:13] <BadApe_> hi, i was wondering what was in the roadmap for the next release?