Hi David,

I think you put the finger on a serious issue here...

We need to make this behavior more predictable and consistent. I suggest
that we systematically propagate the start/stop actions to attached
Restlets:
 - 'next' Restlet for a Filter
 - 'root' Restlet for an Application
 - 'routes' Filters for a Router
 - etc.

This will also remove the current lazy start behavior, but this should be
mostly backward compatible. Any opinion before I change the code in SVN
trunk?
 
Best regards,
Jerome Louvel
--
Restlet ~ Founder and Lead developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com
 

-----Message d'origine-----
De : David Fogel [mailto:carrotsa...@gmail.com] 
Envoyé : jeudi 26 février 2009 20:45
À : discuss@restlet.tigris.org
Objet : RE: Re: Why does the Restlet class have lifecycle methods?

Hi Stephen-

Well, I'm not sure I understand what it means to be "correctly integrated"-
we're creating Restlet subclasses and adding them to Routers, VirtualHosts,
Filters, etc.  Is there something else we need to do to "register" them
somehow?

Looking at the source code in Router, Filter, Application, VirtualHosts
(this is in 1.2M1), I don't find any code which propagates calls to "stop()"
to the "children" of the restlets.  Could this be because there isn't a
strict parent-child relationship in restlet?  I suppose a single restlet
instance could be attached to multiple "parent" Routers, which I suppose
might make it unclear specifically whose responsibility it is to call stop()
on the Restlet.  

Still, it seems to me that if the Restlet API is going to have these
lifecycle methods on what is effectively the base class for all
request-routing entities, that there should be some specific contract as to
when these methods get called.  Otherwise maybe they belong in a separate
interface?

As an aside, I'm also not a big fan of having the Restlet.handle() method
lazily call "start()" on itself.  This provides a very unreliable lifecycle
for a component.  I think it might make more sense to have the "parent" of
the restlet call start() on it, either when it itself is started, or when
the child is attached/added/set, etc.  But this too has its own drawbacks.

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=12345
18

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=1278610

Reply via email to