|
From: Mark R. D. <mdi...@la...> - 2003-02-21 18:00:12
|
Nick, I've added an extra method to the version of ThinController I am using currently, I think it would be a nice addition to the class itself. Specifically, I am providing an "initSim()" method, analogous to "begin()" in the BatchController. This method provides just enought rudimentary threading control to get the simulation launched in a new Thread and wait for it to complete. I did this so I would not need to do "thread management" in my taglibrary wrapper for the controller and I can just rely on the threading available in the ThinController to get the simulation started and wait until its finished before returning from the initSim method. This should allow my taglibrary to support any controller. (as you can see by my examples: models/cagn and models/simple). However, I still find myself having to call different methods to get the controller "initialized". Consolidating Controller.display(),BatchController.begin() and ThinController.initSim() into one standard method in the IController interface would provide for a consistent way to initialize the controller across all controllers. It could be backward compatable for the time being by just creating an initSim method in the IController and BaseController, then overriding it in Controller and BatchController with calls to display or begin. Eventually, uchicago.src.sim.engine.SimInit could be modified to use the new initSim method and there would no longer be the need to determine what type the controller was just to get it initialized/running. I think we had discussed this before, though I can't recall your response. If ThinController.initSim() seems like the "wrong" name for this method, I'm not attached to it. One other thing, in this situation I find the System.exit() call in the ThinController.exitSim() results in the shutdown of the entire JVM, if I'm using it in the Jelly env. where I might want to do post processing after the exitSim occurs I loose the JVM instance before I can do those things. I've been commenting it out in my version. Since it is a method available from "System" I'm concerned about it being in the Controller, specifically because, if the user of ThinController is either doing thier own Thread Management or relying on initSim() for this, they can decide if they want to do a System.exit() after exitSim occures in thier code. Having it in the exitSim method, they loose that flexibility. Thanks -Mark |