[jbosscache-dev] Handling invalid nodes

Manik Surtani manik at jboss.org
Fri May 16 08:27:33 EDT 2008


On 16 May 2008, at 03:51, Elias Ross wrote:

> On Thu, May 15, 2008 at 3:52 PM, Manik Surtani <manik at jboss.org>  
> wrote:
>
>> So the question is this - with potentially likely events marking a  
>> node as
>> invalid - especially with eviction - should we throw a
>> NodeNotValidException?  Since (as of 2.1.0), the Node  
>> implementation that a
>> user has is an instance of NodeInvocationDelegate which in turn has a
>> reference to an UnversionedNode, perhaps we should handle the NNVE  
>> within
>> the NodeInvocationDelegate and perform a lookup internally and  
>> refresh the
>> UnversionedNode reference, and THEN throw a NNVE if we can't fetch  
>> the node?
>
> Something feels wrong about using exceptions as message passing events
> and flow control.

What I meant above was "handle the NNVE situation", represented by the  
validity flag being set to false, not the exception itself.

> You should be able to check if a node is invalid before that exception
> gets thrown. And if you do a retry, it seems possible to get stuck in
> a loop: Exception, refresh succeeds, but immediate eviction again,
> then exception again, etc. Maybe it's really unlikely, but it'd be a
> bummer.
>
> Wouldn't an evict require a write lock? If so, then this couldn't  
> happen.

Yes, evict does acquire WLs.

> Or do this as part of the interception:
> 1. Pre-fetch node, mark as "do not evict", then check again if node is
> valid (would have to use a volatile flag I think)
> 2. Do your business
> 3. Unmark

--
Manik Surtani
Lead, JBoss Cache
manik at jboss.org









More information about the jbosscache-dev mailing list