Hey,

We have a system that migrates our sites based on migration rules, the 
psuedocode is as the following:

session = getNewSession("migration-user");
for(Site site in sites) {
        migrateSite(session)
}

Everything works fine, but we would like it more performant, so the change I 
did was the following:

session = getNewSession("migration-user");
for(Site site in sites) {
        threadPool.submit(new Runnable() { run() { 
                migrateSite(session)
        });
}

This gave the following exception:

21.03.2019 11:32:47.244 *WARN* 
[sling-threadpool-fb6dc0ad-6c32-47c1-9779-e8acba0ef747-(migration-service)-4] 
org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate Attempted to perform 
hasProperty while thread 
sling-threadpool-fb6dc0ad-6c32-47c1-9779-e8acba0ef747-(migration-service)-2 was 
concurrently writing to this session. Blocked until the other thread finished 
using this session. Please review your code to avoid concurrent use of a 
session.

So I decided to change the code to the following:

for(Site site in sites) {
        threadPool.submit(new Runnable() { run() { 
                session = getNewSession("migration-user");
                migrateSite(session)
         });
}

But it seems that the warn that is being thrown is still being thrown, does 
this mean that getting a new session based on the same user name still get into 
lockings / synchronizing issues? Is there any way to solve this? 

Thanks,
Roy

Reply via email to