<br><br><div class="gmail_quote">On Wed, May 27, 2009 at 3:34 PM, Gavin King <span dir="ltr">&lt;<a href="mailto:gavin.king@gmail.com">gavin.king@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
well,<br>
<br>
(1) an Observer could be registered multiple times with diff event bindings<br>
</blockquote><div><br>Ah, I thought it couldn&#39;t, because BeanManager.addObserver took no binding information.  I now see that  Event.addOberver() uses the bindings of the event itself.  <br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
(2) adding a type variable doesn&#39;t help you, since it just gets erased<br>
at runtime </blockquote><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
You can&#39;t do T.class in Java :-)<br>
<div><div></div><div class="h5"></div></div></blockquote><div><br>Good point.  Is the parameterization of addObserver just to ensure that Observer&lt;T&gt; is registered for Class&lt;T&gt;?<br><br>So if an observer can be added for an event with different bindings, why shouldn&#39;t it be possible to remove it from observing the event with a specific binding?   I presume that&#39;s what Event.resumeObserver() does, i.e. removes that observer for the Event&#39;s bindings.  It seems reasonable to want to do that independent of whether you have an event, through the BeanManager.<br>
<br>-Clint<br> <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div class="h5"><br>
On Wed, May 27, 2009 at 1:06 PM, Clint Popetz &lt;<a href="mailto:cpopetz@gmail.com">cpopetz@gmail.com</a>&gt; wrote:<br>
&gt; Now that I&#39;m thinking about it, I wrote &quot;the observer should be removed for<br>
&gt; all events for which it is registered&quot; but because addObserver() is typed to<br>
&gt; Observer&lt;T&gt;, and because you can&#39;t implement the same interface twice (even<br>
&gt; with different parameterizations) any given instance can only be registered<br>
&gt; once.   Well, it could be registered more than once, but the implementation<br>
&gt; (and possibly the spec) could prohibit that, because it&#39;s meaningless.<br>
&gt;<br>
&gt; In that case, I have no problem with the semantics of removeObserver.  But<br>
&gt; the &lt;?&gt; means I&#39;d have to rewrite a lot of observer storage/lookup code, and<br>
&gt; it&#39;s not symmetric with addObserver(), so I wonder what the advantage of the<br>
&gt; wildcard is.<br>
&gt;<br>
&gt; -Clint<br>
&gt;<br>
&gt;<br>
&gt; On Wed, May 27, 2009 at 2:35 PM, Gavin King &lt;<a href="mailto:gavin.king@gmail.com">gavin.king@gmail.com</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; yes, that&#39;s what it means, though I must admit that when I made that<br>
&gt;&gt; change it was not totally clear to me that it was the right thing to<br>
&gt;&gt; do :-/<br>
&gt;&gt;<br>
&gt;&gt; Probably needs a bit more discussion...<br>
&gt;&gt;<br>
&gt;&gt; On Wed, May 27, 2009 at 11:59 AM, Clint Popetz &lt;<a href="mailto:cpopetz@gmail.com">cpopetz@gmail.com</a>&gt; wrote:<br>
&gt;&gt; &gt; Hi,<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; The spec defines BeanManager.removeObserver to have a wildcard type:<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; public void removeObserver(Observer&lt;?&gt; observer);<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; and says &quot;The container must stop sending event notifications to the<br>
&gt;&gt; &gt; deregistered observer.&quot;  Does that sentence, taken with the wildcard<br>
&gt;&gt; &gt; type,<br>
&gt;&gt; &gt; imply that the observer should be removed for all events for which it is<br>
&gt;&gt; &gt; registered?  Currently ManagerImpl implements storage of observers as a<br>
&gt;&gt; &gt; map<br>
&gt;&gt; &gt; from EventType -&gt; Observer, which means removal of an observer without<br>
&gt;&gt; &gt; knowing its event type would be linear in # observers, unless I change<br>
&gt;&gt; &gt; the<br>
&gt;&gt; &gt; implementation.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Thanks,<br>
&gt;&gt; &gt; -Clint<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; --<br>
&gt;&gt; &gt; Clint Popetz<br>
&gt;&gt; &gt; <a href="http://42lines.net" target="_blank">http://42lines.net</a><br>
&gt;&gt; &gt; Scalable Web Application Development<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; _______________________________________________<br>
&gt;&gt; &gt; webbeans-dev mailing list<br>
&gt;&gt; &gt; <a href="mailto:webbeans-dev@lists.jboss.org">webbeans-dev@lists.jboss.org</a><br>
&gt;&gt; &gt; <a href="https://lists.jboss.org/mailman/listinfo/webbeans-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/webbeans-dev</a><br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; --<br>
&gt;&gt; Gavin King<br>
&gt;&gt; <a href="mailto:gavin.king@gmail.com">gavin.king@gmail.com</a><br>
&gt;&gt; <a href="http://in.relation.to/Bloggers/Gavin" target="_blank">http://in.relation.to/Bloggers/Gavin</a><br>
&gt;&gt; <a href="http://hibernate.org" target="_blank">http://hibernate.org</a><br>
&gt;&gt; <a href="http://seamframework.org" target="_blank">http://seamframework.org</a><br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; Clint Popetz<br>
&gt; <a href="http://42lines.net" target="_blank">http://42lines.net</a><br>
&gt; Scalable Web Application Development<br>
&gt;<br>
<br>
<br>
<br>
</div></div>--<br>
<div><div></div><div class="h5">Gavin King<br>
<a href="mailto:gavin.king@gmail.com">gavin.king@gmail.com</a><br>
<a href="http://in.relation.to/Bloggers/Gavin" target="_blank">http://in.relation.to/Bloggers/Gavin</a><br>
<a href="http://hibernate.org" target="_blank">http://hibernate.org</a><br>
<a href="http://seamframework.org" target="_blank">http://seamframework.org</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Clint Popetz<br><a href="http://42lines.net">http://42lines.net</a><br>Scalable Web Application Development<br>