While researching why domain mappings weren't being updated [1], I
discovered that when an AccessManagerPlugin becomes available, the
AccessManagerFactoryTracker closes all JCR sessions that have been
created so far [2]. This seems to kill off any existing event
listeners. I'm not that into the Jackrabbit internals (and maybe this
is a question for the Jackrabbit list), but are EventListeners
supposed to be killed when all sessions close?

This, in effect, is causing the MapEntries to not become notified of
new nodes under /etc/map, so that the domain mappings table is not
being updated.
To reproduce the problem, have a start a Sling instance that already
have an active AccessManagerPlugin, and:
1. Go to http://localhost:8080/system/console/jcrresolver and note the
domain mappings
2. Create a new node /etc/map/http/domain.com, with a
sling:internalRedirect property set to /node
3. Refresh http://localhost:8080/system/console/jcrresolver
Expected result:
- The domain mappings table reflects the new mapping domain.com => /node
Actual result:
- The domain mappings table is unchanged

If you restart the JcrResourceResolverFactory component, the domain
mappings table is updated, and subsequent updates to /etc/map are
reflected. This is because the MapEntries eventlistener is not being
de-registered until a new AccessManagerPlugin is registered.

Is there a reason for closing all sessions when an AMP is registered,
or could we safely remove that code?

[1] http://markmail.org/thread/r4jzqd4pheelo6fq
[2] 
http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/AccessManagerFactoryTracker.java?view=markup#l51

-- 
Vidar S. Ramdal <[email protected]> - http://www.idium.no
Sommerrogata 13-15, N-0255 Oslo, Norway
+ 47 22 00 84 00 / +47 21 531941, ext 2070

Reply via email to