[cdi-dev] Async event proposal
thjanssen123 at gmail.com
Sat Jun 6 07:39:43 EDT 2015
I like the idea of returning the event payload but it would be inconsistent
with the existing fire(U event) method. Am I right, that changing the old
fire method in the same way is not an option?
2015-06-05 19:43 GMT+02:00 Antoine Sabot-Durand <antoine at sabot-durand.net>:
> Yes Jozef,
> As said multiple times we cannot prevent users to mute payload in async
> events but they should know that it's their responsibility to do so (no
> concurrency or thread safety guaranteed by us).
> I have no problem to revert this. My idea was to be consistent with
> synchronous observer returning void.
> I also feared that returning an handle on the payload could confuse users,
> making them think that we manage concurrency and thread safety on the
> payload when we don't do it.
> Now, adding the payload to the async pipeline coule make sense...
> Le ven. 5 juin 2015 à 08:49, Jozef Hartinger <jharting at redhat.com> a
> écrit :
>> On 06/04/2015 10:08 AM, Antoine Sabot-Durand wrote:
>> > In our initial proposal fireAsync basic signature was
>> > <U extends T> CompletionStage<U> fireAsync(U event);
>> > I simplified the signature with
>> > CompletionStage<void> fireAsync (U event);
>> > As the original fire method returns void I found confusing to return
>> > anything something letting think that a value (different than a
>> > status) was obtained from the observers notification.
>> The reason for the original signature was that it allows the event
>> payload to be processed further once all the observers finish. This is
>> useful in the common pattern where you fire a mutable event, let the
>> (possibly unknown) observers contribute to the result by mutating the
>> payload, and then work with the payload when all finish. See e.g.
>> This of course assumes mutable event payloads are supported.
> cdi-dev mailing list
> cdi-dev at lists.jboss.org
> Note that for all code provided on this list, the provider licenses the
> code under the Apache License, Version 2 (
> http://www.apache.org/licenses/LICENSE-2.0.html). For all other ideas
> provided on this list, the provider waives all patent and other
> intellectual property rights inherent in such information.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cdi-dev