You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Eric Pugh <ep...@upstate.com> on 2003/12/18 11:52:53 UTC

ThreadSafe interface

Hi all,

A user recently found a bug in this code:
http://cvs.sourceforge.net/viewcvs.py/hibernate/HibernateExt/avalon/impl/src
/java/net/sf/hibernate/avalon/HibernateServiceImpl.java

where everytime we request a new object from the container, it calls
initialize.   This is a relatively expensive opporation as it loads up a
bunch of xml files and does some runtime bytecode stuff..

So, the fix is to mark it as ThreadSafe, and now ECM only calls the
initialize once.  Which is what I want..  It pretty much is just a
singleton.  However, I thought interfaces like ThreadSafe are are
deprecated, or not to be used...

I want to keep the implementation as clean as possible, but still have it
work in both ECM and modern containers like Merlin..

I was thinking about:

BaseHibernateServiceImpl.java with the minimum interfaces

ECMHibernateServiceImpl.java that adds the ThreadSafe interface

MerlinHibernateServiceImpl.java that adds the lifecyle xdoclet tags for
singleton...

Thoughts?

Eric


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org


RE: ThreadSafe interface

Posted by Eric Pugh <ep...@upstate.com>.
Okay..  I might just go with that as the easiest way..  It just kinda bugs
me to get deprecation warnings when I migrate out of using the ECM
container..

Thanks...

Eric

> -----Original Message-----
> From: news [mailto:news@sea.gmane.org]On Behalf Of Leo Simons
> Sent: Thursday, December 18, 2003 2:26 PM
> To: dev@avalon.apache.org
> Subject: Re: ThreadSafe interface
>
>
> Eric Pugh wrote:
> > I thought interfaces like ThreadSafe are are
> > deprecated, or not to be used...
> >
> > I want to keep the implementation as clean as possible, but
> still have it
> > work in both ECM and modern containers like Merlin..
>
> save yourself some work and create a single class that has the
> ThreadSafe interface *and* the lifecycle tags. Components
> that implement
> ThreadSafe are not going to stop functioning in merlin some day just
> because they do so.
>
> mho :D
>
> - LSD
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
> For additional commands, e-mail: dev-help@avalon.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org


Re: ThreadSafe interface

Posted by Leo Simons <le...@apache.org>.
Eric Pugh wrote:
> I thought interfaces like ThreadSafe are are
> deprecated, or not to be used...
> 
> I want to keep the implementation as clean as possible, but still have it
> work in both ECM and modern containers like Merlin..

save yourself some work and create a single class that has the 
ThreadSafe interface *and* the lifecycle tags. Components that implement 
ThreadSafe are not going to stop functioning in merlin some day just 
because they do so.

mho :D

- LSD



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org