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(a)jboss.org
_______________________________________________
jbosscache-dev mailing list
jbosscache-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jbosscache-dev