db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmars...@apache.org
Subject svn commit: r883574 - in /db/derby/code/branches/10.4/java: engine/org/apache/derby/impl/services/monitor/ testing/org/apache/derbyTesting/functionTests/tests/engine/
Date Tue, 24 Nov 2009 02:31:10 GMT
Author: kmarsden
Date: Tue Nov 24 02:30:52 2009
New Revision: 883574

URL: http://svn.apache.org/viewvc?rev=883574&view=rev
Log:
DERBY-2074 NullPointerException when two threads load sort factory concurrently

Contributed by Knut Anders Hatlen (knut dot hatlen at sun dot com)
merge 789103 from 10.5 branch

Added:
    db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/functionTests/tests/engine/ModuleLoadingTest.java
      - copied unchanged from r789103, db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/engine/ModuleLoadingTest.java
Modified:
    db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/services/monitor/ModuleInstance.java
    db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/services/monitor/TopService.java
    db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/functionTests/tests/engine/_Suite.java

Modified: db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/services/monitor/ModuleInstance.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/services/monitor/ModuleInstance.java?rev=883574&r1=883573&r2=883574&view=diff
==============================================================================
--- db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/services/monitor/ModuleInstance.java
(original)
+++ db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/services/monitor/ModuleInstance.java
Tue Nov 24 02:30:52 2009
@@ -56,6 +56,9 @@
 	*/
 	protected Object	service;
 
+    /** Flag that tells whether booting of the module has completed. */
+    private boolean booted;
+
 	/*
 	** Constructor
 	*/
@@ -111,4 +114,20 @@
 	protected Object getInstance() {
 		return instance;
 	}
+
+    /**
+     * Set a flag that indicates that booting of the module has completed.
+     */
+    synchronized void setBooted() {
+        booted = true;
+    }
+
+    /**
+     * Check whether booting of the module has completed.
+     * @return {@code true} if the module has been booted, or {@code false}
+     * otherwise
+     */
+    synchronized boolean isBooted() {
+        return booted;
+    }
 }

Modified: db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/services/monitor/TopService.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/services/monitor/TopService.java?rev=883574&r1=883573&r2=883574&view=diff
==============================================================================
--- db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/services/monitor/TopService.java
(original)
+++ db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/services/monitor/TopService.java
Tue Nov 24 02:30:52 2009
@@ -255,6 +255,16 @@
 			for (int i = 0; i < moduleInstances.size(); i++) {
 				ModuleInstance module = (ModuleInstance) moduleInstances.elementAt(i);
 
+                // DERBY-2074: The module has not been properly booted, so we
+                // cannot yet determine whether or not this is a module we can
+                // use. Assume that we cannot use it and continue looking. We
+                // may end up booting the module twice if the assumption
+                // doesn't hold, but we'll detect and resolve that later when
+                // we call addToProtocol().
+                if (!module.isBooted()) {
+                    continue;
+                }
+
 				if (!module.isTypeAndName((PersistentService) null, key.getFactoryInterface(), key.getIdentifier()))
 					continue;
 
@@ -294,6 +304,8 @@
 			throw se;
 		}
 
+        module.setBooted();
+
 		synchronized (this) {
 
 

Modified: db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/functionTests/tests/engine/_Suite.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/functionTests/tests/engine/_Suite.java?rev=883574&r1=883573&r2=883574&view=diff
==============================================================================
--- db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/functionTests/tests/engine/_Suite.java
(original)
+++ db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/functionTests/tests/engine/_Suite.java
Tue Nov 24 02:30:52 2009
@@ -47,6 +47,7 @@
         TestSuite suite = new TestSuite("engine");
 
         suite.addTest(ErrorStreamTest.suite());
+        suite.addTest(ModuleLoadingTest.suite());
 
         return suite;
     }



Mime
View raw message