Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8823505
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T06:22:23+00:00 2026-06-14T06:22:23+00:00

Is there a way to create a durable jcr session which is kept alive

  • 0

Is there a way to create a durable jcr session which is kept alive during the whole application lifecycle ? The background is that I want to use this session for a JCR EventListener which updates my view on any incoming event. Therefore this listener has to be always connected with a session I think.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T06:22:25+00:00Added an answer on June 14, 2026 at 6:22 am

    Yes, you can indeed create a regular session, use it to register your event listeners, and keep it alive for as long as necessary.

    In fact, the event listeners will only be notified of events while the session used to register the listener is still alive. Of course, that long-lived session may prevent the repository from shutting down, so always log out of your sessions when your application or service shuts down.

    One common best practice is to have the listener do as little work as possible. Listeners are called asynchronously (meaning the repository doesn’t wait to complete the changes until the listeners to complete), which means this is likely done on a separate thread and the listener might cause resource issues if it takes a long time to complete. So if the work is not trivial, get off the thread as quickly as possible by (for example) submitting work to a queue and processing the queue separately.

    Another best practice is for listeners to not read or write content using the same Session that was used to register them. A JCR Session is not required to be thread safe, and most implementations do not implement concurrency. That means that they cannot be safely used by multiple threads, even if that entails only reading content. (Some implementations do guarantee that Sessions are thread safe, but it’s probably better to avoid relying upon that trait unless you want or need to be locked into that implementation.)

    In summary, if a listener needs to do any work, get off the calling thread and use a separate Session to read or update content.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a way to create a callback function that fires when a list
Is there a way to create an array that is both gettable and settable
Is there a way to create a build definition, in TFS 2010, that uses
Is there any way to create a gradient background using nothing but CSS? You
is there way to create a rule in the jquery validiation plugin that allows
is there a way to create an image slideshow that is rotated by say
Is there a way to create unit tests that can be run with the
Is there any way to create a custom TFS check-in policy that can jump
Is there any way to create a background service (or driver or anything else)
is there any way to create a button which will on click take you

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.