sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tma...@apache.org
Subject svn commit: r1797988 - /sling/trunk/contrib/extensions/distribution/core/src/main/java/org/apache/sling/distribution/agent/impl/ImportingDistributionPackageProcessor.java
Date Wed, 07 Jun 2017 19:29:03 GMT
Author: tmaret
Date: Wed Jun  7 19:29:03 2017
New Revision: 1797988

URL: http://svn.apache.org/viewvc?rev=1797988&view=rev
Log:
SLING-6939 - sling distribution leaks jcr sessions

* ImportingDistributionPackageProcessor does not release resource resolver

Modified:
    sling/trunk/contrib/extensions/distribution/core/src/main/java/org/apache/sling/distribution/agent/impl/ImportingDistributionPackageProcessor.java

Modified: sling/trunk/contrib/extensions/distribution/core/src/main/java/org/apache/sling/distribution/agent/impl/ImportingDistributionPackageProcessor.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/distribution/core/src/main/java/org/apache/sling/distribution/agent/impl/ImportingDistributionPackageProcessor.java?rev=1797988&r1=1797987&r2=1797988&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/distribution/core/src/main/java/org/apache/sling/distribution/agent/impl/ImportingDistributionPackageProcessor.java
(original)
+++ sling/trunk/contrib/extensions/distribution/core/src/main/java/org/apache/sling/distribution/agent/impl/ImportingDistributionPackageProcessor.java
Wed Jun  7 19:29:03 2017
@@ -67,14 +67,15 @@ class ImportingDistributionPackageProces
     @Override
     public void process(DistributionPackage distributionPackage) {
         final long startTime = System.currentTimeMillis();
+        ResourceResolver agentResourceResolver = null;
         try {
             // set up original calling RR
-            ResourceResolver resourceResolver = DistributionUtils.getResourceResolver(callingUser,
authenticationInfo.getAgentService(),
+            agentResourceResolver = DistributionUtils.getResourceResolver(callingUser, authenticationInfo.getAgentService(),
                     authenticationInfo.getSlingRepository(), authenticationInfo.getSubServiceName(),
                     authenticationInfo.getResourceResolverFactory());
 
             // perform importing
-            distributionPackageImporter.importPackage(resourceResolver, distributionPackage);
+            distributionPackageImporter.importPackage(agentResourceResolver, distributionPackage);
 
             // collect stats
             packagesSize.addAndGet(distributionPackage.getSize());
@@ -90,6 +91,8 @@ class ImportingDistributionPackageProces
         } catch (DistributionException e) {
             log.error("an error happened during package import", e);
             allResponses.add(new SimpleDistributionResponse(DistributionRequestState.DROPPED,
e.toString()));
+        } finally {
+            DistributionUtils.ungetResourceResolver(agentResourceResolver);
         }
     }
 



Mime
View raw message