jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cko...@apache.org
Subject svn commit: r1432823 - /jackrabbit/trunk/jackrabbit-jca/src/main/java/org/apache/jackrabbit/jca/JCAManagedConnectionFactory.java
Date Mon, 14 Jan 2013 07:51:27 GMT
Author: ckoell
Date: Mon Jan 14 07:51:27 2013
New Revision: 1432823

URL: http://svn.apache.org/viewvc?rev=1432823&view=rev
Log:
JCR-3491 Start the Repository immediatly in JCA Environment

Modified:
    jackrabbit/trunk/jackrabbit-jca/src/main/java/org/apache/jackrabbit/jca/JCAManagedConnectionFactory.java

Modified: jackrabbit/trunk/jackrabbit-jca/src/main/java/org/apache/jackrabbit/jca/JCAManagedConnectionFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jca/src/main/java/org/apache/jackrabbit/jca/JCAManagedConnectionFactory.java?rev=1432823&r1=1432822&r2=1432823&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jca/src/main/java/org/apache/jackrabbit/jca/JCAManagedConnectionFactory.java
(original)
+++ jackrabbit/trunk/jackrabbit-jca/src/main/java/org/apache/jackrabbit/jca/JCAManagedConnectionFactory.java
Mon Jan 14 07:51:27 2013
@@ -142,6 +142,9 @@ public class JCAManagedConnectionFactory
      */
     public Object createConnectionFactory(ConnectionManager cm)
             throws ResourceException {
+        // JCR-3491 Start the Repository immediatly in JCA Environment. 
+        // If this Instance is in a Cluster it would not get any changes till someone performs
a first login 
+        createRepository();
         JCARepositoryHandle handle = new JCARepositoryHandle(this, cm);
         log("Created repository handle (" + handle + ")");
         return handle;
@@ -192,23 +195,37 @@ public class JCAManagedConnectionFactory
                 }
             }
         }
-
         return null;
     }
 
     /**
-     * Return the repository, automatically creating it if needed.
+     * Create/startup the repository.
      */
-    public synchronized Repository getRepository() throws RepositoryException {
+    @SuppressWarnings("deprecation")
+    private void createRepository() throws ResourceException {
         if (repository == null) {
-            JCARepositoryManager mgr = JCARepositoryManager.getInstance();
-            repository = mgr.createRepository(parameters);
-            log("Created repository (" + repository + ")");
+            try {
+                JCARepositoryManager mgr = JCARepositoryManager.getInstance();
+                repository = mgr.createRepository(parameters);
+                log("Created repository (" + repository + ")");
+            } catch (RepositoryException e) {
+                log("Failed to create repository", e);
+                ResourceException exception = new ResourceException(
+                        "Failed to create repository: " + e.getMessage());
+                exception.setLinkedException(e);
+                throw exception;
+            }
         }
-        return repository;
     }
 
     /**
+     * Return the repository, automatically creating it if needed.
+     */
+    public Repository getRepository() throws RepositoryException {
+        return repository;
+    }
+    
+    /**
      * Log a message.
      */
     public void log(String message) {



Mime
View raw message