[Twisted-Python] Application Start Up and Tear Down

Andrew Bennetts andrew-twisted at puzzling.org
Sun Jul 8 23:53:15 MDT 2007


Pavel Bastov wrote:
> Hi,
> 
> so far I've been using only one Factory in my application. So, all the
> intialization and deinitialization code was in startFactory() /
> stopFactory().
> 
> Now I have to add another protocol with another factory. Is there a
> similar pair of methods for the application (server) where I can
> initialize resources (db pool, for example) upon startup and free them
> upon shutdown?

Make your own Service subclass, and override startService/stopService.

-Andrew.





More information about the Twisted-Python mailing list