[ 
https://issues.apache.org/jira/browse/OAK-8204?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16827995#comment-16827995
 ] 

zhouxu commented on OAK-8204:
-----------------------------

1.create repository

To use Oak in our project simply add a dependency to 
{{org.apache.jackrabbit:oak-jcr:1.0.0}} and to {{javax.jcr:jcr:2.0}}:
DB db = new MongoClient("127.0.0.1", 27017).getDB("oak");
    DocumentNodeStore ns = newMongoDocumentNodeStoreBuilder()
        .setMongoDB(db, "oak", 0)
        .build();
    Repository repo = new Jcr(new Oak(ns)).createRepository();


 
2,create 10 folders,and create 200,000 nodes per folder.
Session session = repository.login(new SimpleCredentials("admin", 
"admin".toCharArray()));
String folderName=null;
String docName=null;
Node root = session.getRootNode();
for(int i=1;i<=10;i++){
    folderName="J"+i;
   
   if (root.hasNode(folderName)) {
       throw new Exception(folderName + " node is exist!");
   }
   Node node = root.addNode(folderName, JcrConstants.NT_FOLDER);
   session.save();
    System.out.println("====create folder "+folderName+" success===");

   for(int j=1;j<=200000;j++){
        docName=folderName+"_"+j+".pdf";
        Node parentNode = getNodeByPath(parentPath);
       node = parentNode.addNode(docName, JcrConstants.NT_FILE);
       //add content node
       ...
       session.save();
   }
}
 

> OutOfMemoryError: create nodes
> ------------------------------
>
>                 Key: OAK-8204
>                 URL: https://issues.apache.org/jira/browse/OAK-8204
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.10.2
>            Reporter: zhouxu
>            Priority: Major
>
> Exception in thread "main" java.lang.OutOfMemoryError: GC overhead limit 
> exceede
> d
>  at java.lang.AbstractStringBuilder.<init>(AbstractStringBuilder.java:68)
> at java.lang.StringBuilder.<init>(StringBuilder.java:101)
>  at org.apache.jackrabbit.oak.commons.PathUtils.concat(PathUtils.java:318
> )
>  at org.apache.jackrabbit.oak.plugins.document.DocumentNodeState.getChild
> NodeDoc(DocumentNodeState.java:507)
>  at org.apache.jackrabbit.oak.plugins.document.DocumentNodeState.hasChild
> Node(DocumentNodeState.java:256)
>  at org.apache.jackrabbit.oak.plugins.memory.MutableNodeState.setChildNod
> e(MutableNodeState.java:111)
>  at org.apache.jackrabbit.oak.plugins.memory.MemoryNodeBuilder.setChildNo
> de(MemoryNodeBuilder.java:343)
>  at org.apache.jackrabbit.oak.plugins.document.AbstractDocumentNodeBuilde
> r.setChildNode(AbstractDocumentNodeBuilder.java:56)
>  at org.apache.jackrabbit.oak.spi.state.ApplyDiff.childNodeAdded(ApplyDif
> f.java:80)
>  at org.apache.jackrabbit.oak.plugins.memory.ModifiedNodeState.compareAga
> instBaseState(ModifiedNodeState.java:412)
>  at org.apache.jackrabbit.oak.spi.state.ApplyDiff.childNodeChanged(ApplyD
> iff.java:87)
>  at org.apache.jackrabbit.oak.plugins.memory.ModifiedNodeState.compareAga
> instBaseState(ModifiedNodeState.java:416)
>  at org.apache.jackrabbit.oak.spi.state.ApplyDiff.childNodeChanged(ApplyD
> iff.java:87)
>  at org.apache.jackrabbit.oak.plugins.memory.ModifiedNodeState.compareAga
> instBaseState(ModifiedNodeState.java:416)
>  at org.apache.jackrabbit.oak.spi.state.ApplyDiff.childNodeChanged(ApplyD
> iff.java:87)
>  at org.apache.jackrabbit.oak.plugins.memory.ModifiedNodeState.compareAga
> instBaseState(ModifiedNodeState.java:416)
>  at org.apache.jackrabbit.oak.plugins.document.ModifiedDocumentNodeState.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to