[ http://issues.apache.org/jira/browse/TORQUE-68?page=comments#action_12459344 ] Thomas Fischer commented on TORQUE-68: --------------------------------------
In principle I agree. But you are opening a big box here. If you remove all static references to runtime-dependent objects, I can see two options: 1) move all static fields to an application-wide context, or 2) do not use any central information any more. I am not sure if 2) is feasible without rewriting all of Torque. 1) is also difficult because you have to replace the self-registering mechanism of the peer classes when they are loaded (they register themselves in a central database map). But how should the peers register zhen ? The peer classes do not know which is the current context (there may be several of them), and the context does not know which peers are around (because they are classes provided by the user, and the context is compiled without these). The only sensible way around this is the mechanism which Greg introduced with the DatabaseMap.initialize() method, which uses a generated map of all database peer classes. The main argument against that approach was startup-time (if you have some hundred tables defined, and only need some of them, all the unused peer and map builder classes must be loaded); but maybe this can be improved if all the map builders are generated within one initializing class (or maybe one per database). But this is nothing which can be addressed in the 3.3 release cycle in my opinion. > DatabaseMap remains empty if Torque is stopped and restarted, causes NPEs > ------------------------------------------------------------------------- > > Key: TORQUE-68 > URL: http://issues.apache.org/jira/browse/TORQUE-68 > Project: Torque > Issue Type: Bug > Components: Runtime, Generator > Affects Versions: 3.3 > Environment: Avalon, JUnit-Tests > Reporter: Thomas Vandahl > > When running tests with the Fulcrum-Testcontainer, the TorqueComponent is > instantiated on every lookup (setUp()) and shutdown on every tearDown(). In > this scenario the first test succeeds and all others fail because the > DatabaseMap contains no tables. This is probably caused by invalid static > references to the DatabaseMap of the previous instance. This situation causes > NullPointerExceptions in several BasePeer methods(e.g. processTables()). -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]