Hi Sumit,

> I have a question about how other are using the 
> Application.isStopped() method.
> If a given application is unhealthy (for example, broken 
> client connectors), is
> it appropriate for the Application to mark itself "stopped"?

There is a simple lifecycle: an application is created in the "stopped"
state. When the "start" method is invoked its state is changed to "started"
if the starting happened successfully, or stays to "stopped" otherwise. If
"started", the "stop" method can be invoked to take down the application,
this must result in the stopping of the application and its state going back
to "stopped".

So before marking itself as "stopped" and application should first invoke
its "stop" method which will change the internal state (via super.stop()
actually).

> I am writing a restlet that monitors the state of all 
> applications within a
> Container, and I'm wondering if a 'isHealthy' call is more 
> appropriate (by an
> interface that a subclass of the Application implements), or 
> whether 'isStopped'
> is a viable alternative.

What do other think? Maybe we should add this state directly on
org.restlet.Application? We could also add a MonitorService to Container
that would monitor the state of all the contained applications and decide
what to do in case on unhealthy state.

Best regards,
Jerome

Reply via email to