[infinispan-dev] [ISPN-548] Discussion on updating the QueryInterceptor to be able to update old keys
Navin Surtani
nsurtani at redhat.com
Fri Jul 23 05:58:54 EDT 2010
On 22/07/10 18:56, Manik Surtani wrote:
> Yes - please, guys - no System.outs!! Use the logger if you need to.
Yeah I know it was just made for easy debugging. I should have removed
it before I committed. I'll go fix that now.
>
> On 22 Jul 2010, at 15:31, Emmanuel Bernard wrote:
>
>> I'd recommend to also remove the System.outs floating around as well ;)
>>
>> On 22 juil. 2010, at 16:19, Israel Lacerra wrote:
>>
>>> So, it is not a problem in my code.
>>>
>>> Navin, changing the two ifs
>>> (if(entry.isCreated())...if(entry.isChanged()), to
>>> if(entry.isCreated())/else my tests works fine.
>>>
>>> thanks!
>>> Israel
>>>
>>> On Thu, Jul 22, 2010 at 10:58 AM, Manik Surtani <manik at jboss.org
>>> <mailto:manik at jboss.org>> wrote:
>>>
>>> entry.isChanged() returns true if the entry is, well, changed.
>>> Changed includes {created, modified, removed}
>>>
>>> entry.isCreated() only returns true if the entry has just been
>>> created in the scope of the invocation.
>>>
>>> See the Javadocs for details:
>>>
>>> http://docs.jboss.org/infinispan/4.1/apidocs/org/infinispan/container/entries/CacheEntry.html#isChanged()
>>> http://docs.jboss.org/infinispan/4.1/apidocs/org/infinispan/container/entries/CacheEntry.html#isCreated()
>>>
>>> Cheers
>>> Manik
>>>
>>> On 22 Jul 2010, at 14:45, Israel Lacerra wrote:
>>>
>>>> Navin,
>>>>
>>>> I update my trunk and I still have a little issue. But, maybe,
>>>> it's a problem in my code, cause I had to change the order of
>>>> QueryInterceptor. This line:
>>>> cache.getAdvancedCache().addInterceptorAfter(inter,
>>>> LockingInterceptor.class); in QueryHelper did not work for me,
>>>> because somehow the LockingInterceptor was not in the
>>>> interceptor chain yet.
>>>>
>>>> Anyway, putting the same key twice:
>>>>
>>>> "Key, value pairing is: - test + org.infinispan.query.Pessoa at 2af8f5
>>>> Entry is created
>>>> Entry is changed
>>>> Key, value pairing is: - test + org.infinispan.query.Pessoa at 1088a1b
>>>> Entry is changed"
>>>>
>>>> entry.isChanged() is always returning true. But, like I said,
>>>> maybe it's a problem with my changes.
>>>>
>>>> I will see it more carefully tomorrow...
>>>>
>>>>
>>>> Israel
>>>>
>>>> On Thu, Jul 22, 2010 at 10:09 AM, Manik Surtani <manik at jboss.org
>>>> <mailto:manik at jboss.org>> wrote:
>>>>
>>>>
>>>> On 21 Jul 2010, at 12:54, Navin Surtani wrote:
>>>>
>>>> > 1 - User does a put()
>>>> > 2 - Interceptor checks the set of keys used within the
>>>> same context to
>>>> > see if the same key has been used
>>>> > 3 - If it has an UPDATE is used.
>>>> > 4 - If not we do an ADD.
>>>>
>>>> Sorry, just saw this. To confirm, this should work even
>>>> beyond the scope of a single invocation, and even a single
>>>> transaction, correct? E.g.,:
>>>>
>>>> Tx1:
>>>> 1) creates a NEW entry using cache.put()
>>>> 2) new entry is indexed
>>>>
>>>> Tx2 (potentially at a later date):
>>>> 1) updates the entry using cache.put()
>>>> 2) the index should be updated
>>>>
>>>> So to that end, just checking the presence of the entry in
>>>> the invocation context is not good enough - all it will tell
>>>> you is whether the entry was touched within the same scope
>>>> (whether that scope is an invocation or a transaction is
>>>> irrelevant).
>>>>
>>>> Mircea's solution of testing entry.isCreated() is a valid one.
>>>>
>>>> Cheers
>>>> Manik
>>>>
>>>> --
>>>> Manik Surtani
>>>> manik at jboss.org <mailto:manik at jboss.org>
>>>> Lead, Infinispan
>>>> Lead, JBoss Cache
>>>> http://www.infinispan.org <http://www.infinispan.org/>
>>>> http://www.jbosscache.org <http://www.jbosscache.org/>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> infinispan-dev mailing list
>>>> infinispan-dev at lists.jboss.org
>>>> <mailto:infinispan-dev at lists.jboss.org>
>>>> https://lists.jboss.org/mailman/listinfo/infinispan-dev
>>>>
>>>>
>>>> _______________________________________________
>>>> infinispan-dev mailing list
>>>> infinispan-dev at lists.jboss.org
>>>> <mailto:infinispan-dev at lists.jboss.org>
>>>> https://lists.jboss.org/mailman/listinfo/infinispan-dev
>>>
>>> --
>>> Manik Surtani
>>> manik at jboss.org <mailto:manik at jboss.org>
>>> Lead, Infinispan
>>> Lead, JBoss Cache
>>> http://www.infinispan.org <http://www.infinispan.org/>
>>> http://www.jbosscache.org <http://www.jbosscache.org/>
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> infinispan-dev mailing list
>>> infinispan-dev at lists.jboss.org
>>> <mailto:infinispan-dev at lists.jboss.org>
>>> https://lists.jboss.org/mailman/listinfo/infinispan-dev
>>>
>>>
>>> _______________________________________________
>>> infinispan-dev mailing list
>>> infinispan-dev at lists.jboss.org <mailto:infinispan-dev at lists.jboss.org>
>>> https://lists.jboss.org/mailman/listinfo/infinispan-dev
>>
>> _______________________________________________
>> infinispan-dev mailing list
>> infinispan-dev at lists.jboss.org <mailto:infinispan-dev at lists.jboss.org>
>> https://lists.jboss.org/mailman/listinfo/infinispan-dev
>
> --
> Manik Surtani
> manik at jboss.org <mailto:manik at jboss.org>
> Lead, Infinispan
> Lead, JBoss Cache
> http://www.infinispan.org
> http://www.jbosscache.org
>
>
>
>
>
>
> _______________________________________________
> infinispan-dev mailing list
> infinispan-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/infinispan-dev
--
Navin Surtani
Intern Infinispan
More information about the infinispan-dev
mailing list