<div class="gmail_quote">On Wed, Oct 20, 2010 at 12:41 PM, Denis Forveille <span dir="ltr">&lt;<a href="mailto:denis.forveille@gmail.com">denis.forveille@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
  The main difference between EJB 3.1 singleton and servlet listener is that the EJB 3.1 solution starts only one component in one<br>
member of the cluster.. Not the latter.<br></blockquote><div><br></div><div>I&#39;ve seen questions about whether a singleton is in fact a unique member in a cluster. Since the Java EE spec doesn&#39;t specifically address clustering (right?), this requirement is open for loose interpretation. In fact, section 4.8 of the EJB 3.1 spec even suggests that this is not a guarantee:</div>
<div><br></div><div><i>A Singleton session bean is a session bean component that is instantiated once per application. In cases<br></i><i>where the container is distributed over many virtual machines, each application will have one bean<br>
</i><i>instance of the Singleton for each JVM.</i></div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
So there is a difference between &quot;application scope&quot; and &quot;application-as-deployed-in-cluster&quot; scope.<br>
Most of the so-called &quot;ApplicationScope&quot; components are not well named IMHO as there is one component per member in a cluster, not 1<br>
per application as deployed in a cluster...<br></blockquote><div><br></div><div>I would definitely agree with you there. The CDI tutorial in the Weld reference guide makes mention of a theoretical @ClusterScoped which would be a more apt choice.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
We have a complex custom in-house solution for this with seam 2 and jEE5/WebSphere 7 (based on distributed map in WAS)  and we are<br>
waiting for EJB3.1 and WAS v8 to have an elegant solution for this and we hope that seam 3 will have a solution also<br></blockquote><div><br></div><div>And that&#39;s precisely the type of solution we want to provide in Seam 3 so that duplication of effort for such custom solutions can be avoided. We certainly welcome your review, feedback or contribution in tackling this scope.</div>
<div><br></div><div>Given that singleton session beans aren&#39;t likely unique in a cluster, then we really need to get serious about offering a cluster-scoped annotation. Pete, JIRA?</div><div><br></div><div>-Dan</div><div>
<br></div></div>-- <br>Dan Allen<br>Principal Software Engineer, Red Hat | Author of Seam in Action<br>Registered Linux User #231597<br><br><a href="http://mojavelinux.com" target="_blank">http://mojavelinux.com</a><br><a href="http://mojavelinux.com/seaminaction" target="_blank">http://mojavelinux.com/seaminaction</a><br>
<a href="http://www.google.com/profiles/dan.j.allen" target="_blank">http://www.google.com/profiles/dan.j.allen</a><br>