db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t.@apache.org
Subject svn commit: r571790 - in /db/torque/runtime/trunk/src/java/org/apache/torque: TorqueInstance.java manager/AbstractBaseManager.java
Date Sat, 01 Sep 2007 12:40:45 GMT
Author: tv
Date: Sat Sep  1 05:40:44 2007
New Revision: 571790

URL: http://svn.apache.org/viewvc?rev=571790&view=rev
Log:
- Added one line to copy the db-adapter from the database to its "default" reference and a
test to show that it was necessary. :-)
- Added a public method to the managers to make sure auxiliary caches are
properly shut down during Torque shutdown.

Modified:
    db/torque/runtime/trunk/src/java/org/apache/torque/TorqueInstance.java
    db/torque/runtime/trunk/src/java/org/apache/torque/manager/AbstractBaseManager.java

Modified: db/torque/runtime/trunk/src/java/org/apache/torque/TorqueInstance.java
URL: http://svn.apache.org/viewvc/db/torque/runtime/trunk/src/java/org/apache/torque/TorqueInstance.java?rev=571790&r1=571789&r2=571790&view=diff
==============================================================================
--- db/torque/runtime/trunk/src/java/org/apache/torque/TorqueInstance.java (original)
+++ db/torque/runtime/trunk/src/java/org/apache/torque/TorqueInstance.java Sat Sep  1 05:40:44
2007
@@ -432,11 +432,14 @@
             if ((!defaultDBName.equals(DEFAULT_NAME))
                 && databaseInfoForKeyDefault.getDataSourceFactory() == null)
             {
-                log.debug("Adding the DatasourceFactory from database "
+                log.debug("Adding the DatasourceFactory and DatabaseAdapter from database
"
                         + defaultDBName
                         + " onto database " + DEFAULT_NAME);
                 databaseInfoForKeyDefault.setDataSourceFactory(
                         defaultDatabase.getDataSourceFactory());
+                databaseInfoForKeyDefault.setAdapter(
+                        defaultDatabase.getAdapter());
+                
                 this.defaultDsfIsReference = true;
             }
         }
@@ -684,6 +687,19 @@
                 {
                     idBroker.stop();
                 }
+            }
+        }
+        
+        // shut down the cache managers
+        synchronized (managers)
+        {
+            for (Iterator it = managers.entrySet().iterator(); it.hasNext();)
+            {
+                Map.Entry mentry = (Map.Entry)it.next();
+                
+                AbstractBaseManager manager = (AbstractBaseManager)mentry.getValue();
+                manager.dispose();
+                it.remove();
             }
         }
 

Modified: db/torque/runtime/trunk/src/java/org/apache/torque/manager/AbstractBaseManager.java
URL: http://svn.apache.org/viewvc/db/torque/runtime/trunk/src/java/org/apache/torque/manager/AbstractBaseManager.java?rev=571790&r1=571789&r2=571790&view=diff
==============================================================================
--- db/torque/runtime/trunk/src/java/org/apache/torque/manager/AbstractBaseManager.java (original)
+++ db/torque/runtime/trunk/src/java/org/apache/torque/manager/AbstractBaseManager.java Sat
Sep  1 05:40:44 2007
@@ -225,6 +225,20 @@
     }
 
     /**
+     * Disposes of the cache. This triggers a shutdown of the connected cache
+     * instances. This method should only be used during shutdown of Torque. The
+     * manager instance will not cache anymore after this call.
+     */
+    public void dispose()
+    {
+        if (cache != null)
+        {
+            cache.dispose();
+            cache = null;
+        }
+    }
+
+    /**
      * Remove an object from the cache
      *
      * @param key the cache key for the object



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Mime
View raw message