bloomreach / docs-feedback

1 stars 0 forks source link

Verify accuracy? #122

Closed arthurk777 closed 1 year ago

arthurk777 commented 1 year ago

https://xmdocumentation.bloomreach.com/library/concepts/web-application/retrieving-a-pooled-session.html

Hi, could we verify the accuracy of this article?

Per the article, I would not logout this hstconfigreader (sample code below), as it is pooled, but BR professional services recommended that I do a "session.logout();"

    Repository repo = HstServices.getComponentManager().getComponent(Repository.class.getName());
    Credentials creds = HstServices.getComponentManager().getComponent(Credentials.class.getName() + ".hstconfigreader");
    Session session = repo.login(creds);

Thanks!

nvankampenhout commented 1 year ago

Hi @arthurk777 , let me check this internally and I'll get back to you.

nvankampenhout commented 1 year ago

Hi @arthurk777 , I updated the documentation page with some additional info.

Basically, pooled sessions will be automatically logged out and returned to the pool based on an idle timer, so developers are not required to log out. However logging out explicitly when done with a pooled session is a recommended best practice because it makes the session available again immediately.

I hope this clarifies things.

arthurk777 commented 1 year ago

Thanks for clarifying. It might be worth revising the article to avoid confusion for others. We only took action and removed all session logouts after seeing that article.

nvankampenhout commented 1 year ago

Yes we already updated the documentation page, it now says:

JCR Sessions retrieved through the component manager as explained above, are managed by HST session pools. Developers are not required to log out pooled sessions; they will eventually be automatically logged out based on an idle timer. However it is recommended to always log out a pooled session once it is no longer needed, so that it is returned to the pool immediately, decreasing the chance that requests get blocked because all the pooled sessions are in use.