[infinispan-dev] Optional in listener events
Adrian Nistor
anistor at redhat.com
Mon Aug 22 04:31:00 EDT 2016
Hi Radim,
Continuous query is built on top of these listeners. CQ _always_ needs
the previous value and it is very convenient in this case that the
command is forced to load the previous value. I imagine there may be
other use cases where we cannot live without the prev value.
I think the listener should be able to state if it needs the prev value
at registration time. Maybe add a new attribute in the Listener
annotation? Similar to how we handled Observation.
Adrian
On 08/19/2016 11:34 PM, Radim Vansa wrote:
> Hi,
>
> as I am trying to simplify current entry wrapping and distribution code,
> I often find that listeners can get wrong previous value in the event,
> and it sometimes forces the command to load the value even if it is not
> needed for the command.
>
> I am wondering if we should change the previous value in events to
> Optional - we can usually at least detect that we cannot provide a
> reliable value (e.g. after retry due to topology change, or because the
> command did not bothered to load the previous value from cache loader)
> and return empty Optional.
>
> WDYT?
>
> Radim
>
More information about the infinispan-dev
mailing list