henning 2003/07/24 03:31:27
Modified: src/java/org/apache/torque Torque.java
src/java/org/apache/torque/avalon TorqueComponent.java
Log:
The latest change by dlr broke the Avalon Usage of Torque in a quite
subtle way: When initializing as an Avalon Component, the TorqueInstance
was created by "new", initialized and stored in the TorqueComponent
Later, some parts of the code still call the Torque.<xxx> facade
methods (e.g. Jdbc2PoolDataSourceFactory). As the Torque facade has no
knowledge of an TorqueComponent object already existing, it creates
another, unconfigured, TorqueInstance.
Boom.
Revision Changes Path
1.90 +2 -2 db-torque/src/java/org/apache/torque/Torque.java
Index: Torque.java
===================================================================
RCS file: /home/cvs/db-torque/src/java/org/apache/torque/Torque.java,v
retrieving revision 1.89
retrieving revision 1.90
diff -u -r1.89 -r1.90
--- Torque.java 2 Jul 2003 23:03:57 -0000 1.89
+++ Torque.java 24 Jul 2003 10:31:27 -0000 1.90
@@ -141,7 +141,7 @@
*
* @return Our singleton.
*/
- private static TorqueInstance getInstance()
+ public static TorqueInstance getInstance()
{
if (torqueSingleton == null)
{
1.7 +7 -2 db-torque/src/java/org/apache/torque/avalon/TorqueComponent.java
Index: TorqueComponent.java
===================================================================
RCS file:
/home/cvs/db-torque/src/java/org/apache/torque/avalon/TorqueComponent.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- TorqueComponent.java 2 Jul 2003 23:03:58 -0000 1.6
+++ TorqueComponent.java 24 Jul 2003 10:31:27 -0000 1.7
@@ -107,7 +107,12 @@
*/
public TorqueComponent()
{
- this(new TorqueInstance());
+ // If we simply do a "new TorqueInstance()" here, we will get
+ // into trouble when some internal classes (e.g. the DatasSource Factory)
+ // simply calls Torque.<xxx> and gets a different TorqueInstance
+ // than the one we configured here. Make sure that we use the
+ // same object as the Facade class does.
+ this.torqueInstance = org.apache.torque.Torque.getInstance();
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]