Hello,
looking again into the core interfaces I realized, that I should retrieve my services in the service() method and not in the initilize() method. Right?
nope :D It depends on your needs!
I usually do so if possible because any ServiceException can just be passed back to the container and the code is clean and clear that way (and fails early if it does, also good). But there's lots of reasons to do this later. According to the contract surrounding the servicemanager, you can even get stuff from it after you've start()ed your component!
I've done this, because I followed the Fortress' servlet example, nut looking into Fortress' AbstractContainer all services are retrieved in the service() method.
Which leeds to another question, because I thought thast the contract around ServiceManager is, that every element retrieved with lookup should be released again.
...should be released again *when you're done using it*. IE you don't want to spend lots of effort making sure you release components when your component is in a bad state due to the container not doing its job.
Note that there's lots of applications which run perfectly well without ever calling release() :D In particular, in phoenix if a hosted app is restarted all its resources are destroyed and recreated anyway, and you normally get simple threadsafe/perclassloader services from SM anyway, so there's no memory leakage.
But yes, generally, release absolutely everything in dispose() (or stop()). I often even set all component members to null to take dumb GC into account from the days when java was all buggy :D
Well, the AbstractContainer implementation never releases its services. Design flaw?
can't tell by head; might very well be! If AbstractContainer never stops using its services it shouldn't release them :D
cheers,
- Leo
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
