[jbosscache-dev] Handling invalid nodes

Manik Surtani manik at jboss.org
Mon May 19 06:42:23 EDT 2008


That could work as well, except that a node may be evicted such that  
the UnversionedNode reference help by the NodeInvocationDelegate would  
be invalid.  After loading, a new UnversionedNode may be created.   
Works for the duration of a single invocation, but to make this really  
useful we'd have to swap the reference in the NodeInvocationDelegate  
as well.  I don't see why we can't do this though.  So, +1.



On 19 May 2008, at 10:57, Mircea Markus wrote:

> What about doing the isInvalid check(and exception throwing ) in an  
> interceptor that would be AFTER the CacheLoaderInterceptor? Phps  
> CallInterceptor?
>
>
> Manik Surtani wrote:
>> Guys,
>>
>> I've been thinking about behaviour with the Node API, and wonder  
>> what works best from a user standpoint.  Consider:
>>
>> * User gets a hold of a node and holds on to the ref for  
>> performance reasons (Node n = cache.getNode(fqn))
>> * Performs tasks on the node: n.put(), n.get(), etc.
>> * Node checks for validity before performing any API calls,  
>> throwing a NodeNotValidException if the node is not valid anymore.
>>
>> Nodes get marked as invalid if they are removed or moved by a  
>> concurrent thread, or invalidated by a remote one.  Eviction did  
>> not mark a node as invalid, but I think this is inconsistent and a  
>> bug: eviction too should mark the node as invalid.
>>
>> 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?
>>
>> Th drawback is that this is potentially two calls for what should  
>> be one - node gets evicted, we call cache.getNode() internally to  
>> refresh the reference (from a cache loader, etc), and then invoke  
>> whatever call the user intended to call up the interceptor chain.   
>> The benefit is a smoother user experience.
>>
>> Thoughts/opinions?
>>
>> Cheers,
>> -- 
>> Manik Surtani
>> Lead, JBoss Cache
>> manik at jboss.org
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> jbosscache-dev mailing list
>> jbosscache-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/jbosscache-dev

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









More information about the jbosscache-dev mailing list