On Sat, 2008-08-23 at 02:04 -0700, David Blevins wrote: > All, > > We've implemented the new EJB 3.1 javax.ejb.Singleton bean type. > Singletons are a new type of Session bean being added to the EJB 3.1 > specification. They provide some much needed functionality to the > world of EJB and will be part of the coming OpenEJB 3.1 release. > > http://openejb.apache.org/singleton-beans.html > > http://openejb.apache.org/singleton-example.html > > Enjoy the first ever @Singleton bean implementation! > > A large part of our motivation for implementing this early is to > gather feedback for the specification itself. This is one of those > rare times where you can not only give feedback about our > implementation but about the actual API as well! > > Give it a try and let us know what you think! > > -David > > Example source code: svn co > http://svn.apache.org/repos/asf/openejb/trunk/openejb3/examples/simple-singleton/ >
Hi David, impressive work indeed, thank you very much! I am especially grateful for the Singleton and Startup functionality which I missed. I have one question: in your example (the ComponentRegistryBean example) a simple HashMap is used which is thread unsafe. Does that mean that only a single thread (the one which created the bean) will access the bean? Nope, that's not it - multiple threads can access methods with Lock.READ. What does the specification say about the thread safety/multithreading issues? Must the bean be thread-safe or container will mark all methods as synchronized? Can the user code rely on some locking mechanisms (or invariants) performed by the container (for example, will Lock.WRITE always perform lock on the bean class?) Sorry if it is a dumb question and I'm missing something obvious :) Sincerely, Martin
signature.asc
Description: This is a digitally signed message part