Hello All,
We know that binding variables like
session - javax.jcr.Session
resourceResolver - org.apache.sling.api.resource.ResourceResolver are available for use in groovy scripts.
We can use this JCR session to execute SQL queries, update node properties.
But, we are not closing JCR Session and ResourceResolver explicitly like session.logout() and resourceResolver.close() in groovy script.
How resourceResolver and session are getting closed automatically in groovy script?
Thanks,
Debal
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @Debal-Das ,
If you are not opening any resource or session, you don't have to close it
Session and ResourceResolver objects that are obtained via the SlingRequest or WorkflowSession do not close by your application. For example:
slingRequest.getResourceResolver().adaptTo(Session.class);
//Or
workflowSession.getSession();
That resolver or session closes automatically after the request has been processed.
Hope this helps.
Thanks
Hi @Debal-Das ,
If you are not opening any resource or session, you don't have to close it
Session and ResourceResolver objects that are obtained via the SlingRequest or WorkflowSession do not close by your application. For example:
slingRequest.getResourceResolver().adaptTo(Session.class);
//Or
workflowSession.getSession();
That resolver or session closes automatically after the request has been processed.
Hope this helps.
Thanks
Hi,
If you are not opening any resource or session, you don't have to close it.
Similar when you get a session from a request or getting PrintWriter from a response, you use it and leave it because you did not open it explicitly.
and you should not close any resource/session if you did not open it.
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies