At 11:44 AM 1/4/02 -0500, Daniel Popowich wrote: >Is there a "proper" way to have webkit launch a service with the start >of an appserver? I'm imagining a hook (a la emacs' hooks) that can be >defined in a config file so whenever AppServer starts I can have >arbitrary python code executed.
The "proper" way to do startup code is to put the startup code into the __init__.py in your context directory. This gets imported when the appserver starts up, for all contexts defined in your Application.config. >Similarly, for some of my Servlets I would like to establish a network >connection to a service, but it's not clear how Servlet instantiation >happens or if/how it can be controlled. I guess I'm looking for a >thread-hook: Anytime a particular Servlet is instantiated by one of >the executing threads, how do I a get code executed? My intuition >says to override __init__() but there's no doc that I've found about >the dos and don'ts of doing this. As far as I can tell there's no >arguments to the default constructor, but will that always be the >case? Will I run into trouble with future releases? Servlets get instantiated on an as-needed basis. So the first time a servlet is used, an instance will be created. Keep in mind that WebKit will create multiple instances of a servlet if that servlet is being requested simultaneously. So if you're running WebKit with 10 threads, you may have up to 10 instances of that servlet instantiated. WebKit never deletes the instances until the appserver is stopped -- instead, it maintains them in a pool. Your intuition is correct -- you can safely rely on your servlet's __init__ to be called with no arguments when your servlet is instantiated. I don't see that ever changing. -- - Geoff Talvola [EMAIL PROTECTED] _______________________________________________ Webware-discuss mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/webware-discuss
