jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r933694 - in /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/jndi: BindableRepository.java BindableRepositoryFactory.java
Date Tue, 13 Apr 2010 16:00:03 GMT
Author: jukka
Date: Tue Apr 13 16:00:03 2010
New Revision: 933694

URL: http://svn.apache.org/viewvc?rev=933694&view=rev
Log:
JCR-1778: BindableRepositoryFactory doesn't handle repository shutdown

Fix based on the patch by René Link

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/jndi/BindableRepository.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/jndi/BindableRepositoryFactory.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/jndi/BindableRepository.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/jndi/BindableRepository.java?rev=933694&r1=933693&r2=933694&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/jndi/BindableRepository.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/jndi/BindableRepository.java
Tue Apr 13 16:00:03 2010
@@ -255,6 +255,7 @@ public class BindableRepository extends 
      * Delegated to the underlying repository instance.
      */
     public void shutdown() {
+        BindableRepositoryFactory.removeReference(reference);
         repository.shutdown();
         try {
             Runtime.getRuntime().removeShutdownHook(hook);

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/jndi/BindableRepositoryFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/jndi/BindableRepositoryFactory.java?rev=933694&r1=933693&r2=933694&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/jndi/BindableRepositoryFactory.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/jndi/BindableRepositoryFactory.java
Tue Apr 13 16:00:03 2010
@@ -16,15 +16,16 @@
  */
 package org.apache.jackrabbit.core.jndi;
 
-import org.apache.commons.collections.map.ReferenceMap;
+import java.util.Hashtable;
+import java.util.Map;
 
 import javax.jcr.RepositoryException;
 import javax.naming.Context;
 import javax.naming.Name;
 import javax.naming.Reference;
 import javax.naming.spi.ObjectFactory;
-import java.util.Hashtable;
-import java.util.Map;
+
+import org.apache.commons.collections.map.ReferenceMap;
 
 /**
  * <code>BindableRepositoryFactory</code> is an object factory that when given
@@ -42,7 +43,7 @@ public class BindableRepositoryFactory i
     /**
      * {@inheritDoc}
      */
-    public synchronized Object getObjectInstance(
+    public Object getObjectInstance(
             Object obj, Name name, Context nameCtx, Hashtable environment)
             throws RepositoryException {
         synchronized (cache) {
@@ -55,4 +56,17 @@ public class BindableRepositoryFactory i
         }
     }
 
+
+    /**
+     * Invalidates the given reference in this factory's cache. Called by
+     * {@link BindableRepository#shutdown()} to remove the old reference.
+     *
+     * @param reference repository reference
+     */
+    static void removeReference(Reference reference) {
+        synchronized (cache) {
+            cache.remove(reference);
+        }
+    }
+
 }



Mime
View raw message