Hi,

What about declaring the packages Vector as a static member.  This way we
only build list of packages the first time and never again. Something like
this

static private Vector packages = null;
....
if (packages == null)
{
        Vector packages = TurbineResources.getVector("module.packages");
        ObjectUtils.addOnce( packages,
                             GenericLoader.getBasePackage() );
}

I think we should stick with the addOnce to check if the user has maybe
added the basePackage to the properties file manually.  This will ensure
that org.apache.turbine.modules does not get added a second time if the user
adds it in TR.properties.

~ Leon

> Hi Diethelm,
>
> I believe that it should not do a vector.contains(...) every
> time it tries to perform getInstance() and therefore either:
>  * use a local flag that marks that the base package was added
> or
>  * use "vector.size() == 0" and expect the administrator to
>    have configured the TR properties file according to the
>    instructions (which states that org.apache.turbine.modules
>    should be added at the end of the path).
>
> Just my 2c for performace.
> :) Christoph
>
>
> "Diethelm Guallar, Gonzalo" wrote:
> > Quick solution: would it be Ok to replace that code with
> >
> >   Vector packages = TurbineResources.getVector("module.packages");
> >   String basePackage = GenericLoader.getBasePackage();
> >   if (! vector.contains(basePackage))
> >     packages.addElement( basePackage );
> >
> > everywhere? If yes, would this be a candidate for a utility
> > function, and where (what class)?
>
>
> ------------------------------------------------------------
> To subscribe:        [EMAIL PROTECTED]
> To unsubscribe:      [EMAIL PROTECTED]
> Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
> Problems?:           [EMAIL PROTECTED]
>



------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?:           [EMAIL PROTECTED]

Reply via email to