[infinispan-dev] BucketBasedCacheStore#loadBucket does not set the bucketName

Adrian Cole ferncam1 at gmail.com
Thu Apr 9 13:08:31 EDT 2009


I think that that coupled with an assertion or two could help us not
break the contract.

On Thu, Apr 9, 2009 at 7:00 PM, Manik Surtani <manik at jboss.org> wrote:
> Hmm,  that actually wont work since Bucket is Externalizable.  What we
> should do this this:
>
> 1.  Ensure we have a ctor that takes in a name.  This is the only ctor that
> should be used by the cache stores directly, and should be documented as
> such.
> 2.  The empty ctor is purely for deserialization.  And this should be
> documented accordingly as well.  With all the caveats that if it is used,
> the name *must* be set immediately afterwards.
> 3.  Provide a helper method in BucketBasedCacheStore to load a bucket from a
> stream.
>
> protected final Bucket loadFromStream(String bucketName, ObjectInput in) {
>   // read from stream
>   // set name
>   // return
> }
>
> so that store impls never have to worry about setting the name, even if the
> bucket is obtained by deserializing a stream.
>
> WDYT?
>
> Cheers
> Manik
>
>
> On 9 Apr 2009, at 17:47, Adrian Cole wrote:
>
>> +1 for making bucket name final, set in constructor.
>>
>> On Thu, Apr 9, 2009 at 6:45 PM, Manik Surtani <manik at jboss.org> wrote:
>>>
>>> Is there any reason for a Bucket's name *not* to be final, and as such,
>>> set
>>> in its constructor?
>>>
>>> On 9 Apr 2009, at 17:40, Adrian Cole wrote:
>>>
>>>> When in BucketBasedCacheStore.removeLockSafe, the following is called:
>>>>
>>>> Bucket bucket = loadBucket(keyHashCodeStr);
>>>>
>>>> now, the bucket returned does not always have its name set (at least
>>>> in the BaseCacheStoreTest:402)
>>>>
>>>> I would suggest to either enforce bucket's immutable name field, or
>>>> ensure it is set on all options.  Otherwise, all cachestore
>>>> implementations have to check this individually.
>>>>
>>>> WDYT?
>>>>
>>>> -Adrian
>>>>
>>>> _______________________________________________
>>>> infinispan-dev mailing list
>>>> infinispan-dev at lists.jboss.org
>>>> https://lists.jboss.org/mailman/listinfo/infinispan-dev
>>>
>>> --
>>> Manik Surtani
>>> manik at jboss.org
>>> Lead, Infinispan
>>> Lead, JBoss Cache
>>> http://www.infinispan.org
>>> http://www.jbosscache.org
>>>
>>>
>>>
>>>
>>>
>
> --
> Manik Surtani
> manik at jboss.org
> Lead, Infinispan
> Lead, JBoss Cache
> http://www.infinispan.org
> http://www.jbosscache.org
>
>
>
>
>




More information about the infinispan-dev mailing list