Author: fmeschbe Date: Tue Jan 13 03:31:47 2009 New Revision: 734106 URL: http://svn.apache.org/viewvc?rev=734106&view=rev Log: SLING-826 configuration alone does not help. But according to http://db.apache.org/derby/docs/10.4/devguide/tdevdvlp20349.html we can get a connection to jdbc:derby:;shutdown ignoring the exception thrown. This causes the derby to really shutdown and be eligible for GC.
Modified: incubator/sling/trunk/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/Activator.java Modified: incubator/sling/trunk/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/Activator.java URL: http://svn.apache.org/viewvc/incubator/sling/trunk/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/Activator.java?rev=734106&r1=734105&r2=734106&view=diff ============================================================================== --- incubator/sling/trunk/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/Activator.java (original) +++ incubator/sling/trunk/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/Activator.java Tue Jan 13 03:31:47 2009 @@ -20,6 +20,7 @@ import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; +import java.sql.DriverManager; import java.util.Hashtable; import org.apache.sling.jcr.base.util.RepositoryAccessor; @@ -106,7 +107,21 @@ } public void stop(BundleContext arg0) { - // nothing to do + + /* + * when stopping Derby (which is used by Jackrabbit by default) a + * derby.antiGC thread keeps running which prevents this bundle from + * being garbage collected ... we try to really stop derby here and + * ignore the exception since according to + * http://db.apache.org/derby/docs/10.4/devguide/tdevdvlp20349.html this + * exception will always be thrown. + */ + + try { + DriverManager.getConnection("jdbc:derby:;shutdown=true"); + } catch (Throwable t) { + // exception is always thrown + } } // ---------- ServiceListener ----------------------------------------------