On Wednesday 02 December 2015 15:48:34 Chetan Mehrotra wrote:
> On Wed, Dec 2, 2015 at 2:20 PM, Oliver Lietz <[email protected]> wrote:
> > but this is not the case for a single node, right? And I assume a
> > non-cluster setup as H K didn't mention it.
> 
> Code that HK mentioned above
> 
> ------------
> // REST service createChildFolder running on localhost:8040
> public void createChildFolder(String parentPath, String childName) {
>             DB database = new MongoClient("127.0.0.1",
> 27017).getDB("sling"); DocumentNodeStore store = new
> DocumentMK.Builder().setMongoDB(database).getNodeStore();
>             Repository repo = new Jcr(new Oak(store)).createRepository();
>             SimpleCredentials creds = new SimpleCredentials("admin",
> "admin".toCharArray());
>             Session session = (javax.jcr.Session) repository.login(creds);
>             Node parent = session.getRootNode().getNode(parentPath);
>             Node child = parent.addNode(childName, "sling:Folder");
>             session.save();
>             session.logout();
>             store.dispose();
> }
> ------------
> 
> It technically creates a new Oak instances and thus you have a
> cluster! Had he connected to Sling using Remoting and not via Oak then
> it would be a single node case

Thanks, Chetan. Is it really the _new Oak_ or the new NodeStore which sets up 
a cluster? I would guess the new NodeStore as in my test with the same 
NodeStore and new Oak no sleep was required to get the previously created 
node. The Oak documentation for clustering could be more expressive...

O.

> Chetan Mehrotra

Reply via email to