The high level conceptual issue is we have one class for Region (IMO good). But, Region
has 4 different use cases: 1) eviction, 2) marshalling/classloading, 3) region
activation/inactivation and 4) PojoCache reference scoping. Marshalling and
activation/inactivation are related, but there isn't a 100% conceptual overlap.
Region activation/inactivation is also usable as a way to get partial state transfer, even
if there are no classloader issues involved.
In 2.0 we deal with the different use cases by sometimes passing a Region.Type into the
getRegion() method. We scan through all registered regions looking for Fqn matches. Then
based on the requested type, we check characteristics of the regions to see if they match.
The code block in my first post shows that.
Two problems with this:
1) Somewhat inefficient, since if we're looking for eviction region /a and there's
marshalling region /a/b/c, we do a map lookup for /a/b/c, reject the marshalling region,
then do a map lookup for /a/b (miss) and then finally do a map lookup for /a and get our
eviction region. Seems more efficient to do a map lookup for /a/b/c, and then call
getParent() on the region until we find an eviction region.
2) If we request a marshalling region, the current algorithm returns null if there is no
region with a classloader registered. That's a new behavior added in 2.0; didn't
work that way in 1.x. In 1.x you could create a "marshalling" region and never
register a classloader. That's why you had to add a region registration to the unit
test.
The second problem can be solved without doing the nested region thing I've suggested
on this thread. You just change getRegion such that if Region.Type.MARSHALLING is passed,
you keep a ref to the lowest region you find. You then keep looking for one with a
classloader registered. If you find one with a classloader, return it. If not, return the
first one you found.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4066730#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...