6 Replies Latest reply on Feb 6, 2010 4:17 AM by Bernd Ruecker

    Problems with adding SVN file via JCR

    Bernd Ruecker Master

      Hey guys.

       

      Sorry for raising the next problem! But since reading works I wanted to create a file in SVN with this code:

       

      // add a new file as jcr type
      Node fileNode = rootNode.addNode(file.getName(), "nt:file");
      Node contentNode = fileNode.addNode("jcr:content", "nt:resource");
      contentNode.setProperty ("jcr:mimeType", "text");
      contentNode.setProperty ("jcr:lastModified", Calendar.getInstance());
      contentNode.setProperty("jcr:data", file.getTextContent());
                     
      System.out.println("## STARTING TO SAVE ##");
      rootNode.getSession().save();
      System.out.println("## SAVED ##");
      

       

      The problem is, that the session.save method never returns. When I pause during a debug session the stacktrace where it waits is:


      Thread [main] (Suspended)     
           Unsafe.park(boolean, long) line: not available [native method]     
           LockSupport.park(Object) line: not available     
           CountDownLatch$Sync(AbstractQueuedSynchronizer).parkAndCheckInterrupt() line: not available     
           CountDownLatch$Sync(AbstractQueuedSynchronizer).doAcquireSharedInterruptibly(int) line: not available     
           CountDownLatch$Sync(AbstractQueuedSynchronizer).acquireSharedInterruptibly(int) line: not available     
           CountDownLatch.await() line: not available     
           FederatedRequest.await() line: 97     
           JoinRequestProcessor.process(BlockingQueue<FederatedRequest>) line: 141     
           FederatedRepositoryConnection.execute(ExecutionContext, Request) line: 226     
           Graph.execute(Request) line: 267     
           Graph$Batch.execute() line: 4599     
           GraphSession<Payload,PropertyPayload>.save() line: 813     
           SessionCache.save() line: 374     
           JcrSession.save() line: 880     
           JcrFileSystemConnector.createNewFile(FolderInfo, FileInfo) line: 242     
           FolderInfo.addFile(FileInfo) line: 46     
           JcrFileSystemConnectTest.testAddFile() line: 59
      

       

      Any ideas? And I haven't found any JCR example / test cases in ModeShape, only the internal API's are used, or did I miss anything?

       

      Thanks

      Bernd

        • 1. Re: Problems with adding SVN file via JCR
          Randall Hauch Master

          Don't worry about finding too many issues. We want to find all of the problems as soon as we can, and you're helping us do that. Thank you for your time and patience!

           

          There's a problem with the interaction between the federation connector (used internally within our JCR implementation) and the SVN connector. The federation connector uses a fork-join approach, so it has multiple threads and one of them is blocking. That's what's going wrong, anyway. To figure out the solution, I'll have to replicate the problem and spend a fair amount of time debugging multi-threaded code, and that will take some time.

           

          Would you mind logging another defect for this?  It'd also be awesome if you could attach any sample code you can share, or at least describe your configuration (and particularly what your SVN setup looks like).  That would make it easier to replicate the problem.

          • 2. Re: Problems with adding SVN file via JCR
            Randall Hauch Master

            Bernd, I created an issue for this so that I can start working on it: https://jira.jboss.org/jira/browse/MODE-658  It doesn't currently have much content, but it does point to this thread.  Feel free to make corrections or add more detail.

            • 3. Re: Problems with adding SVN file via JCR
              Randall Hauch Master


              And I haven't found any JCR example / test cases in ModeShape, only the internal API's are used, or did I miss anything?

              We actually have a lot of test cases, but most of these are unit tests. We do have a number of integration tests (in the 'modeshape-integration-tests' project), but to date we've been relying mostly on the JCR TCK unit tests, and that's something we need to correct.

               

              I would also like to see more formal examples covered in our Getting Started guide, to go along with the existing sequencer and repositories examples. Maybe we need one that shows how to use JCR on top of SVN (probably the kinds of things you're doing now in your code). Please let us know if you have any ideas about what this example can/should show (beyond reading and uploading files ... is there much else?)

              • 4. Re: Problems with adding SVN file via JCR
                Bernd Ruecker Master
                Okay, I will as well blog about it and a working example as soon as it is working :-) There I can give some kudos to you guys as well!
                • 5. Re: Problems with adding SVN file via JCR
                  Randall Hauch Master

                  rhauch wrote:

                   

                  Bernd, I created an issue for this so that I can start working on it: https://jira.jboss.org/jira/browse/MODE-658  It doesn't currently have much content, but it does point to this thread.  Feel free to make corrections or add more detail.

                   

                  The fix for this issue has been committed to trunk, and the issue has been marked as 'resolved'.  See the issue for a thorough description of the problem and the fix.  Let us know whether this works, and if it doesn't feel free to re-open the defect.

                  • 6. Re: Problems with adding SVN file via JCR
                    Bernd Ruecker Master

                    Hi Randall.

                     

                    Jepp, that looks pretty good, it adds the file correctly now. Thanks again for the quick fix!

                     

                    Cheers

                    Bernd