henning 2003/06/22 15:23:39
Modified: src/java/org/apache/torque TorqueSingleton.java
Log:
- Make sure that Torque can't be initialized twice
- set isInit really at the end of initialize true
- initialize() is now single threaded
Revision Changes Path
1.4 +12 -3 db-torque/src/java/org/apache/torque/TorqueSingleton.java
Index: TorqueSingleton.java
===================================================================
RCS file: /home/cvs/db-torque/src/java/org/apache/torque/TorqueSingleton.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- TorqueSingleton.java 22 Jun 2003 19:37:04 -0000 1.3
+++ TorqueSingleton.java 22 Jun 2003 22:23:39 -0000 1.4
@@ -186,8 +186,16 @@
* @throws TorqueException Any exceptions caught during processing will be
* rethrown wrapped into a TorqueException.
*/
- private void initialize() throws TorqueException
+ private synchronized void initialize() throws TorqueException
{
+ log.debug("initialize()");
+
+ if (isInit)
+ {
+ log.debug("Tried to initialize multiple times");
+ return;
+ }
+
if (conf == null)
{
throw new TorqueException("Torque cannot be initialized without "
@@ -212,7 +220,6 @@
initAdapters(conf);
initDataSourceFactories(conf);
- isInit = true;
for (Iterator i = mapBuilders.iterator(); i.hasNext();)
{
//this will add any maps in this builder to the proper database map
@@ -223,6 +230,8 @@
// setup manager mappings
initManagerMappings(conf);
+
+ isInit = true;
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]