[
https://issues.apache.org/jira/browse/SLING-4564?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Carsten Ziegeler resolved SLING-4564.
-------------------------------------
Resolution: Fixed
I've implemented this with (by default) four event listeners:
- one for each root path (libs, apps)
- one for move events
- one for root tracking removal of one of the root paths
The dispatching is now done in each listener for the root path. While this is
not the most optimal implementation, resources below the root path do not
change that much.
The advantage of this implementation is that it avoids using jackrabbit
specific api.
In addition I refactored the implementation further and now moved all
configuration into the new InstallerConfig data object. I also synchronized the
access to the watched folders which wasn't done previously.
> Use a single listener registered for multiple path in JCR installer
> -------------------------------------------------------------------
>
> Key: SLING-4564
> URL: https://issues.apache.org/jira/browse/SLING-4564
> Project: Sling
> Issue Type: Improvement
> Components: Installer
> Affects Versions: JCR Installer 3.1.8
> Reporter: Chetan Mehrotra
> Assignee: Carsten Ziegeler
> Fix For: JCR Installer 3.1.16
>
>
> Sling Jcr installer currently registers one listener per watched folder. On
> an application like AEM this results in ~150 listeners out of total 210 to
> belong to Jcr installer.
> Recently Jackrabbit introduced support for adding [additional
> path|https://github.com/apache/jackrabbit/blob/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/observation/JackrabbitEventFilter.java#L232]
> to listen to as part of JCR-3745. This can be leveraged by the Jcr installer
> to avoid registering multiple listeners and instead use one listener.
> The above feature can be used in following form
> {code}
> String[] paths = searchPaths.toArray(new String[]{});
> JackrabbitEventFilter eventFilter = new JackrabbitEventFilter()
> .setAbsPath(paths[0])
> .setEventTypes(Event.NODE_ADDED |
> Event.NODE_REMOVED |
> Event.NODE_MOVED |
> Event.PROPERTY_ADDED |
> Event.PROPERTY_CHANGED |
> Event.PROPERTY_REMOVED )
> .setIsDeep(true)
> .setNoLocal(false)
> .setNoExternal(true);
> if (paths.length > 1) {
> eventFilter.setAdditionalPaths(paths);
> }
> JackrabbitObservationManager observationManager =
> (JackrabbitObservationManager)
> adminSession.getWorkspace().getObservationManager();
> observationManager.addEventListener(this, eventFilter);
> {code}
> This would allow more efficient observation processing and avoid putting load
> on system as Oak currently maintains one queue per listener.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)