Hello,
We are using Jackrabbit in standalone mode to get some of the benefits of having the DB and index in a centralized server (backup/restore for example).
As we know, Jackrabbit is not optimized in this mode for performance.
We have done some changes to avoid making large number of RMI calls by extending the interface.
I would like to know if these changes would be eligible to be included in the next version of Jackrabbit. I think they would benefit other developers needing to use Jackrabbit in standalone mode (and would save us painful merges when we update to latest version of jackrabbit)
 
This is the summary of the changes:

The idea is that first we create a local node which is a mimic of a JCR remote node except that it works locally: no RMI calls for every operation of it. Next, we will modify 4 classes of Jackrabbit RMI package: ClientQueryResult, ServerQueryResult, ClientSession and ServerSession; and create 1 new class: ConverterUtil

    * ClientQueryResult class: add 3 new methods
          o getLocalNodes(): return a list of local nodes including all their children by calling ServerQueryResult.getLocalNodes()
          o getLocalNodes(int ancestorLevel): return a list of local nodes including only children in the ancestor level given by calling ServerQueryResult.getLocalNodes(int ancestorLevel)
          o getQueryResultNodes(): return a list of local nodes without children by calling ServerQueryResult.getQueryResultNodes(). The method is used for optimizing the query result time; it retrieves only the current nodes but not for children.
    * ConverterUtil new class: define 2 methods:
          o convertToLocalNode(...): convert a JCR remote node into a local node
          o convertToJCRNode(...): convert a local node into a JCR remote node
    * ServerQueryResult class: add 2 new methods:
          o getLocalNodes(): responsible for converting JCR remote nodes including all of their children node into local nodes using ConverterUtil.convertToLocalNode(...) and return the local nodes
          o getLocalNodes(int ancestorLevel): responsible for converting JCR remote nodes including only children node in the ancestor level given into local nodes using ConverterUtil.convertToLocalNode(...) and return the local nodes
          o getQueryResultNodes(): responsible for converting JCR remote nodes without children into local nodes using ConverterUtil.convertToLocalNode(...) and return the local nodes.

    * ClientSession class: adding a new method called saveLocalNodes(List<LocalNode>). The method simply passes the local nodes given to ServerSession.saveLocalNodes(List<LocalNode>).
    * ServerSession class: adding a new method called saveLocalNodes(List<LocalNode>) is in charge of converting the local nodes into JCR nodes using ConverterUtil.convertToJCRNode(...) and then saving the JCR nodes to the repository.

Note that ServerQueryResult and ServerSession class work at server side (JackRabbit Standalone), so all of their operations are considered as at local.

With the approach, we optimize a number of RMI calls: no RMI call for operations such as: Node iteration, set/get properties and add/remove node. Only 2 main RMI calls are done when ClientQueryResult.getLocalNodes()/ClientQueryResult.getLocalNodes(int ancestorLevel)/ClientQueryResult.getQueryResultNodes() and ClientSession.saveLocalNodes(List<LocalNode>) methods are called.

 

Best Regards,

Antonio