Hi!
marc fleury wrote:
> > > At the same time I would see for a nice service where you
> > provide a set of
> > > services that are needed for a particular configuration. You would be
> > > notified immediately through a boolean return that all the services you
> > > requested are already on line. And what you register is a callback
> > > interface with methods such as "public void allOnline()", equivalent of
> > > "dinner is served" for the service, but also maybe a "public boolean
> > > serviceGoingDown(Service orSomething)" as soon as one of the
> > services in the
> > > required set is going down. This way you don't have to code the
> > > notifications yourself, it is a JMXBean of sorts.
> >
> > Nah, could be even simpler. When the requirements are set the nice
> > service could dynamically invoke "start" on the service. No need for the
> > actual service to be involved at all. And that's the neat thing: the
> > service that has the dependencies does not have to be changed *at all*.
> > I think this is how the relationship service in JMX is supposed to work;
> > if it doesn't, we'll make one like that.
>
> if you want to call "start" instead of "allOnline" that is fine. However we
> can simply make the case that "serviceGoingDown" is a finer grain
> notification than "stop", hence the need for an interface.
Actually, the current ServiceMBeanSupport class, which most services
should subclass, has the states STARTING/STARTED/STOPPING/STOPPED. You
would send out STOPPING first to allow dependent services to stop, and
*then* stop the actual service.
I.e. logs would be something like:
Foo stopping
Bar stopping
Xyzzy stopping
Xyzzy stopped
Bar stopped
Foo stopped
...
In the above example Bar depends on Foo, and Xyzzy depends on Bar.
/Rickard
--
Rickard �berg
Email: [EMAIL PROTECTED]
http://www.telkel.com
http://www.jboss.org
http://www.dreambean.com