Ironic how other projects have driven out Singletons from their code - was
it PHP Symphony or something like that? Anyway, all things in their place.



On 13 March 2013 14:32, Howard W. Smith, Jr. <smithh032...@gmail.com> wrote:

> Interesting conversation/facts/etc... here!
>
> singleton is basically the model that 'spring' propagated for years? wow
> (shaking my head)... I purposely have avoided being or becoming a 'spring'
> user and said to myself, Java EE 6 (reference implementation) clearly is
> sufficient to meet any/all my Java EE needs. :)
>
> anyway, i am using @Singleton more and more in my app...thanks to advice
> given by David Blevins months ago. :)
>
>
> On Wed, Mar 13, 2013 at 4:46 AM, Romain Manni-Bucau
> <rmannibu...@gmail.com>wrote:
>
> > was no more clear for me ;)
> >
> > singleton is basically the model spring propagated for years and which is
> > now known as very efficient
> >
> >
> > *Romain Manni-Bucau*
> > *Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
> > *Blog: **http://rmannibucau.wordpress.com/*<
> > http://rmannibucau.wordpress.com/>
> > *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
> > *Github: https://github.com/rmannibucau*
> >
> >
> >
> > 2013/3/13 Jean-Louis MONTEIRO <jeano...@gmail.com>
> >
> > > I agree Romain, but it only works in that specific situation:
> > > - EM type=TRANSACTION (not Extended)
> > > - Java EE environment (not Java SE)
> > >
> > > And I also agree using a Singleton bean makes both true as it's not
> > allowed
> > > as per the spec to obtain an Extended PC in a Singleton.
> > >
> > > My purpose was just to try to get things clearer.
> > >
> > > Jean-Louis
> > >
> > >
> > > 2013/3/13 Romain Manni-Bucau <rmannibu...@gmail.com>
> > >
> > > > Em is clearly thread safe in a javaee envrt in transaction mode...at
> > > least
> > > > because of the transaction constraint you can get the same instance
> in
> > > > different threads
> > > > Le 13 mars 2013 08:40, "Jean-Louis MONTEIRO" <jeano...@gmail.com> a
> > > écrit
> > > > :
> > > >
> > > > > As a pure user feedback, we've been using OpenEJB/TomEE stateless
> > beans
> > > > on
> > > > > huge applications and it does not produce any significant
> > > > > nor noticeable overhead as soon as the pool size is well set up.
> > > > >
> > > > > So i'm really confident.
> > > > > That said, the way singleton works with a READ lock is better in
> lots
> > > of
> > > > > cases (no instances to manage, no locks in the pool, less memory
> > > > > consumption, etc).
> > > > >
> > > > > But you are also right, it does not apply in any cases, I mean
> using
> > > > > stateless session beans is still relevant in some situations. Even
> > if I
> > > > > tend to preferably use Singleton, it's sometimes not applicable.
> > > > >
> > > > > Moreover you are right, EM is not thread safe as per the spec even
> if
> > > > some
> > > > > implementations (Hibernate for example) are in some situations. We
> > > > > discussed that point recently in the expert group as far as I
> recall.
> > > > >
> > > > > Hope it helps,
> > > > > Jean-Louis
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > 2013/3/13 zeeman <hamz...@fastmail.us>
> > > > >
> > > > > > I have to disagree with some of the gurus here. In most cases a
> > > > stateless
> > > > > > or
> > > > > > singleton bean is going to use an entityManager/hibernate session
> > to
> > > > get
> > > > > > data to/from the DB. EM is not thread safe, using a singleton
> with
> > > read
> > > > > > lock
> > > > > > will cause concurrency issues on EM. So stateless in that case is
> > the
> > > > way
> > > > > > to
> > > > > > go as it'll have its own EM instance. For scalable applications
> > this
> > > > > would
> > > > > > work well.
> > > > > >
> > > > > > Having strict pooling = false with proper max/min values (based
> on
> > > > > expected
> > > > > > app load) will work as suggested.
> > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > > View this message in context:
> > > > > >
> > > > >
> > > >
> > >
> >
> http://openejb.979440.n4.nabble.com/ConcurrentAccessTimeoutException-tp4661288p4661466.html
> > > > > > Sent from the OpenEJB User mailing list archive at Nabble.com.
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > Jean-Louis
> > > > >
> > > >
> > >
> > >
> > >
> > > --
> > > Jean-Louis
> > >
> >
>

Reply via email to