avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Farr, Aaron" <Aaron.F...@am.sony.com>
Subject [merlin] fine grain component startup control
Date Mon, 08 Dec 2003 22:29:22 GMT

Okay, so we've discussed this before a bit but I ran into the problem again
today.  Perhaps someone has some new ideas.  Simple situation:

Two Components:
  1. JMS Server
  2. JMS Client

Both get imported into a root block.xml and are activated on startup.
What's the problem?  Well, of course, the JMS client wants to start up
before the server.  Why is this not easily fixed?

1. There is way to control startup order of components

2. Component startup is sequential.  That is, say we put some code in JMS
Client to delay startup, something like "Thread.sleep(5000);" in the
initialize() method in order to give the Server time to start, well, if the
client is scheduled to start first, the client will delay, fail, and then
perhaps the server will attempt to start.  If components were started in
their own thread, then this delay hack might work.

3. Meta level dependencies don't work here.  We are not talking about
something that the client needs from the service manager, we're talking
about something it looks up via JNDI.  Perhaps our notion of dependency
needs to expand.  Moreover, because the client and server are compiled
separately (there are NO compile time dependencies between them) the meta
plugin complains if you try to cheat and add a (fake) dependency on the JMS
Server to the JMS client because it cannot find any meta data for the Server
within the Client project. 

4. Even if you figure out a proper startup order, the real trick comes with
knowing when the server is really ready.  The server launches a number of
threads on startup, so the initialize() or start() method may return, but
that doesn't mean the server is ready.  Knowing when the server is ready to
accept clients is not easy unless the server sends some sort of
notification, which is even a more difficult problem is you're using some
third party components.

If there were a way to specify component startup order, or priority, that
would help a lot.  Or we might need to expand our definition of dependencies
to include other blocks/services which are not used by the service manager
and perhaps not even the local jar file/project/block.


J. Aaron Farr
  (724) 696-7653

To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org

View raw message