Hi Jon,
thanks for the commit (it is very usefull for people that cannot actually
commit but do use the framework as much as I do!)
I don't think it is necessary to check for nulls. The cache reference
is itinialized in the init() method of the service.
If we should check for a null in this method, then why we don't check
in the getObject method, for example?

The -1 value is also not correct since we are dealing with a
service here. The cache Hashtable is just an internal implementation
of the service. The user should not care if it is null. So in the case
of null, the method should return 0 (a user does not have any
idea of the internals of the class). Thus being:
        return cache == null ? -0 : cache.size();

In either case, I think it is not necessary,
Costas


----- Original Message -----
From: "Jon Stevens" <[EMAIL PROTECTED]>
To: "turbine-dev" <[EMAIL PROTECTED]>
Sent: Thursday, May 03, 2001 9:38 AM
Subject: Re: [PATCH] TurbineGlobalCacheService


> on 5/2/01 11:26 PM, "Costas Stergiou" <[EMAIL PROTECTED]> wrote:
>
> > Hi all,
> > I send a small patch with a simple utillity method for the
> > TurbineGlobalCacheService. Can anyone please commit it
> > or if there is any argument on that discuss it?
> > thanks,
> > Costas
> >
> >
> > diff -u -r1.12 TurbineGlobalCacheService.java
> > --- TurbineGlobalCacheService.java 2001/04/05 04:02:56 1.12
> > +++ TurbineGlobalCacheService.java 2001/04/30 07:01:09
> > +    /**
> > +     * Returns the number of objects currently stored in the cache
> > +     *
> > +     * @return int number of object in the cache
> > +     */
> > +    public int getNumberOfObjects()
> > +    {
> > +        return cache.size();
> > +    }
> > }
>
> This isn't a valid patch (try to apply it yourself).
>
> Your code also didn't check for nulls. I hand applied it and made the
> appropriate changes. Please try harder next time to at least provide a
> working patch.
>
> ...
>
>     /**
>      * Returns the number of objects currently stored in the cache
>      *
>      * @return int number of object in the cache or -1 if the cache is
null
>      */
>     public int getNumberOfObjects()
>     {
>         return cache == null ? -1 : cache.size();
>     }
>
> Thanks,
>
> -jon
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to