Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

session logout clarification

Avatar

Level 6

Hi,

Need some clarification on session in AEM.

When ever we create jcr session explicitly we need to session.logout() method to avoid  session leaking is my understanding is right.

 

But if we adopt session by workflow Session like below

Session session = worflowSession.adaptTo(Session.class);

did we need to close session by session.logout or not

i have written many workflow in my project by i have not done session.logout() will it automatically closing in case of workflowsession ??

 

 

 

 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Please refer to below documentation URL:

https://experienceleague.adobe.com/docs/experience-cloud-kcs/kbarticles/KA-16548.html

 

Important Note:

Session and ResourceResolver objects that are obtained via the SlingRequest or WorkflowSession should not to be closed by your application.  For example:

slingRequest.getResourceResolver().adaptTo(Session.class); //Or workflowSession.getSession();

That resolver and session will be closed automatically after the request has been processed.

 

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

Please refer to below documentation URL:

https://experienceleague.adobe.com/docs/experience-cloud-kcs/kbarticles/KA-16548.html

 

Important Note:

Session and ResourceResolver objects that are obtained via the SlingRequest or WorkflowSession should not to be closed by your application.  For example:

slingRequest.getResourceResolver().adaptTo(Session.class); //Or workflowSession.getSession();

That resolver and session will be closed automatically after the request has been processed.