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.
create durable jcr session
285 Views Asked by nico1510 At
1
There are 1 best solutions below
Related Questions in JAKARTA-EE
- Which Should i use for date,time,email in servlet?
- Simple JavaEE HTML GET/POST application
- Updating the message contents for a MessageDialog wicket
- Access roles from multiple applications
- How to compile an individual jsp file from command line
- DB2, Hibernate, JPA: Schema does not exist
- Spring load a file
- Execute RequestDispatcher after 5 seconds
- Hibernate Lazy loading not work in OneToOne relation
- Websphere 8.5.5 - shared session context not working
- withSchedule(ScheduleBuilder<SBT>) in the type TriggerBuilder<Trigger> is not applicable for arguments (MutableTrigger)
- Setting response header using interceptor?
- How to use the same ContainerRequestFilter for multiple projects?
- [Ljava.lang.Object; cannot be cast to List from a request SQL
- which should i use in request.getParameter in servlet?
Related Questions in JACKRABBIT
- Sling 7 JCR SQL Query Fails On Unicode-Value Properties
- "Destroying connection that could not be successfully matched"
- JCR vs JPA for a DMS: performance, benefits, drawbacks
- jackrabbit-webapp-2.10.1.war on tomcat7
- How does Jackrabbit generate jcr:uuid (in AEM)?
- How to query jackrabbit jcr to get nodes ordered by number of matches (using SQL2/XPATH)?
- How to fix inconsistency in Jackrabbit JCR (BundleFsPersistenceManager)
- Temporary files are not getting deleted in Apache Jackrabbit
- Jackrabbit with PostgreSQL backend leaves repository in inconsistent state
- How to query Jackrabbit for a property value on all the file versions?
- How to create content in apache sling using java program
- Switch from MySql driver to MariaDB driver for Jackrabbit
- JCR Node.getReferences() doesn't work
- Index and full-text-search with Jackrabbit, Lucene using Tika
- How To Get Current Jackrabbit User In Felix Request Filter?
Related Questions in JCR
- Sling 7 JCR SQL Query Fails On Unicode-Value Properties
- Adobe CQ: Copy node from one CQ instance to another using crx/de
- Sling Mock is not allowing to get ResourceResolverFactory
- Javax JCR Node getProperties and Titles
- Apache sling : org.apache.sling.api.resource.PersistenceException: Unable to create node at /var/discovery))
- How to programatically delete revisions of a page in CQ5?
- JCR vs JPA for a DMS: performance, benefits, drawbacks
- AccessDeniedException when writing into JCR (JackRabbit) [Magnolia]
- How does Jackrabbit generate jcr:uuid (in AEM)?
- CQ - Check whether the resource object is valid
- How to query jackrabbit jcr to get nodes ordered by number of matches (using SQL2/XPATH)?
- Temporary files are not getting deleted in Apache Jackrabbit
- Recursive search in JCR repo via java
- How to stop filevault to compress jcr hierarchy?
- How to Query Jackrabbit for same name siblings
Related Questions in CONTENT-REPOSITORY
- What exactly is the definition of a content repository?
- Standard Interface to Interact with Various Content Repositories From J2EE Client Server Environment Using JCR
- Should I organize content in content repositories like I do in file systems?
- Use of MixinTypes in JCR
- What is a workspace in a content repository?
- What is a Node and a Property in content repository?
- How to learn using content repository and Apache JackRabbit?
- How to check if node is removed from content repository?
- JCR session closed by container causes duplicate attempt to close session
- How to create repository instance in JackRabbit Oak using MicroKernel
- Actual Jackrabbit/Oak guides and documentation
- Azure enabling content trust will impact exisitng images in registry?
- Label:- XMLContent De-duplication
- Minimum set of libraries required to use Jackrabbit JCR implementation?
- see if the node exists in Jackrabbit AbstractWebDavServlet in JackRabbit
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
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.