[
https://issues.apache.org/jira/browse/OAK-2760?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14497672#comment-14497672
]
Francesco Mari commented on OAK-2760:
-------------------------------------
I think that the best option would be to cache the {{ContentRepository}} in
{{Jcr}} and make it available to its users. The {{Oak}} builder doesn't just
change its own state, but also the state of the system embedding the repository
- e.g. via an OSGi whiteboard.This would mean that every service would be
registered anew at every invocation of {{Oak.createContentRepository()}}.
> HttpServer in Oak creates multiple instance of ContentRepository
> ----------------------------------------------------------------
>
> Key: OAK-2760
> URL: https://issues.apache.org/jira/browse/OAK-2760
> Project: Jackrabbit Oak
> Issue Type: Sub-task
> Components: run
> Reporter: Chetan Mehrotra
> Priority: Minor
> Fix For: 1.3.0
>
>
> Http Server in oak-run constructs multiple repository instance of
> ContentRepository [1]
> {code}
> Jcr jcr = new Jcr(oak);
> // 1 - OakServer
> ContentRepository repository = oak.createContentRepository();
> ServletHolder holder = new ServletHolder(new
> OakServlet(repository));
> context.addServlet(holder, path + "/*");
> // 2 - Webdav Server on JCR repository
> final Repository jcrRepository = jcr.createRepository();
> {code}
> In above code a repository instance is created twice via same Oak instance 1
> in OakServer and 2 for webdav.
> [1]
> https://github.com/apache/jackrabbit-oak/blob/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/Main.java#L1125-1133
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)