<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Reviving this thread.<div><br></div><div>It's become a requirement for [1] that we have listeners invoked on the primary data owner only. &nbsp;I think this is better than a singleton, since you'd have all nodes sharing the workload of handling events, just that they'd be evenly distributed.</div><div><br></div><div>See&nbsp;<a href="https://issues.jboss.org/browse/ISPN-3201">https://issues.jboss.org/browse/ISPN-3201</a>&nbsp;for details.</div><div><br></div><div>As for reliability guarantees, we don't have that for listeners in general. &nbsp;I.e., an event may get missed if a node goes down. &nbsp;So an event being missed or fired on the wrong node due to a topology change and a change of primary data owner would be expected, IMO.</div><div><br></div><div>Cheers</div><div>Manik</div><div><br></div><div>[1]&nbsp;<a href="http://leads-project.eu/">http://leads-project.eu/</a></div><div><br></div><div><br><div><div>On 10 Jul 2012, at 07:36, Dan Berindei &lt;<a href="mailto:dan.berindei@gmail.com">dan.berindei@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><br><div class="gmail_quote">On Mon, Jul 9, 2012 at 5:52 PM, Galder Zamarreño <span dir="ltr">&lt;<a href="mailto:galder@redhat.com" target="_blank">galder@redhat.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im"><br>
On Jul 6, 2012, at 12:44 PM, Mircea Markus wrote:<br>
<br>
&gt; ----- Original Message -----<br>
&gt;&gt; From: "Galder Zamarreño" &lt;<a href="mailto:galder@redhat.com">galder@redhat.com</a>&gt;<br>
&gt;&gt; To: "infinispan -Dev List" &lt;<a href="mailto:infinispan-dev@lists.jboss.org">infinispan-dev@lists.jboss.org</a>&gt;<br>
&gt;&gt; Sent: Friday, July 6, 2012 2:46:20 AM<br>
&gt;&gt; Subject: Re: [infinispan-dev] singleton @Listeners<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; On Jun 28, 2012, at 11:26 AM, Mircea Markus wrote:<br>
&gt;&gt;<br>
&gt;&gt;&gt; This is a problem that pops up constantly:<br>
&gt;&gt;&gt; User: &nbsp; &nbsp; &nbsp;"I add a listener to my distributed/replicated cache but<br>
&gt;&gt;&gt; this gets invoked numOwners times - can I make that to be invoked<br>
&gt;&gt;&gt; only once cluster wise?"<br>
&gt;&gt;&gt; Developer: "Yes, you can! You have to do that and that..."<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; What about a "singleton" attribute on the Listener? Would make the<br>
&gt;&gt;&gt; reply shorter:<br>
&gt;&gt;&gt; Developer: "Use @Listener(singleton=true)"<br>
&gt;&gt;<br>
&gt;&gt; Hmmm, that seems doable without any extra attributes.<br>
&gt;&gt;<br>
&gt;&gt; For a replicated cache, take the view and pick a node (consistently<br>
&gt;&gt;<br>
&gt;&gt; For a distributed cache, find the primary owner of a key.<br>
&gt; That's pretty much how I had in mind to implement it. But I think the attribute is needed though: there are use cases in which you still want to be notified on all the owners, as you do now. OTOH if you only want a per-cluster notification you'd add this attribute to the listener.<br>

&gt;&gt;<br>
&gt;&gt; Has this been asked so often? I don't recall right now… :)<br>
&gt; Yes, CBOE had the same issue as they needed to push updates from one cluster to the other over hotrod.<br>
&gt; Also in this article they have to do quite a workaround to enforce uniqueness: &nbsp;<a href="http://blog.c2b2.co.uk/2012/06/infinispan-event-push-to-tomcat.html" target="_blank">blog.c2b2.co.uk/2012/06/infinispan-event-push-to-tomcat.html</a><br>

&gt; And there were some others :)<br>
<br>
</div>Ok. I'm thinking about the priority of this.<br>
<br>
I think our listeners are very buggy, as I've already ranted a few times (thread safety guarantees, plus rather akward programming model), but the agreement was to not touch them till we get around to implementing JSR-107 notifications.<br>

<br>
So, I think what we should do now is:<br>
<br>
1. Document the patterns to get around the problem that you explain.<br>
<br>
2. Hold of implementing any new listener functionality cos it's quite likely gonna need reimplementing one way or the other when we get around to JSR-107<br>
<br>
My 2 pesetas :)<br>
<br>
</blockquote></div><br>+1<br>
_______________________________________________<br>infinispan-dev mailing list<br><a href="mailto:infinispan-dev@lists.jboss.org">infinispan-dev@lists.jboss.org</a><br>https://lists.jboss.org/mailman/listinfo/infinispan-dev</blockquote></div><br><div>
<div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; border-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; border-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>--</div><div>Manik Surtani</div><div><br></div></div></span></div></span></div></span></div><br class="Apple-interchange-newline">
</div>
<br></div></body></html>