You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by "Farr, Aaron" <Aa...@am.sony.com> on 2003/12/08 23:29:22 UTC

[merlin] fine grain component startup control

Hello.

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.

Thoughts?

J. Aaron Farr
  SONY ELECTRONICS
  DDP-CIM
  (724) 696-7653



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


Re: [merlin] fine grain component startup control

Posted by Timothy Bennett <ex...@comcast.net>.
Stephen McConnell wrote:

> 
> 
> Farr, Aaron wrote:
> 
>> If there were a way to specify component startup order, or priority, that
>> would help a lot.
> 
> 
> Basically I agree with Nicols point oif view here

me too..

> - however - I just 
> want to throw in something that has been bugging me and may help address 
> some aspects of your issue.  Currently in merlin the block is parsed 
> relative to types of children - i.e. get all of the compoennt build the 
> metadata, get all of the subcontainers, build their metadata, get all of 
> includes, build the meta data.  A better approach would be to process 
> metadata creation exactly in the order declared in the block.xml.  This 
> would result in a more predictable ordering of component deployment.
> 

+1 as a good place to start... I've got a situation right now along 
these lines that is really bugging me.  Trying to reuse the 
hsqldb-component and the cornerstone-datasources component in a merlin 
container.  The hsqldb MUST start before the datasource component... 
very tricky with merlin...  at least with phoenix there was a somewhat 
predictable pattern.



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


Re: [merlin] fine grain component startup control

Posted by Stephen McConnell <mc...@apache.org>.

Farr, Aaron wrote:

>If there were a way to specify component startup order, or priority, that
>would help a lot. 
>

Basically I agree with Nicols point oif view here - however - I just 
want to throw in something that has been bugging me and may help address 
some aspects of your issue.  Currently in merlin the block is parsed 
relative to types of children - i.e. get all of the compoennt build the 
metadata, get all of the subcontainers, build their metadata, get all of 
includes, build the meta data.  A better approach would be to process 
metadata creation exactly in the order declared in the block.xml.  This 
would result in a more predictable ordering of component deployment.

Stephen.

>
>Thoughts?
>
>J. Aaron Farr
>  SONY ELECTRONICS
>  DDP-CIM
>  (724) 696-7653
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
>For additional commands, e-mail: dev-help@avalon.apache.org
>
>
>  
>

-- 

Stephen J. McConnell
mailto:mcconnell@apache.org

|------------------------------------------------|
| Magic by Merlin                                |
| Production by Avalon                           |
|                                                |
| http://avalon.apache.org/merlin                |
| http://dpml.net/                               |
|------------------------------------------------|





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


Re: [merlin] fine grain component startup control

Posted by J Aaron Farr <fa...@apache.org>.
On Tue, 2003-12-09 at 00:49, Niclas Hedhman wrote:
> On Tuesday 09 December 2003 06:29, Farr, Aaron wrote:
> > 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.  
> 
> IMHO, No, we don't need to expand the notion of dependency.
> We need to remove the "static assembly" and introduce a "Service Availability" 
> contract. 

<snip>

> Making sense?

Yes.  This is along the ideas of container events that has been
discussed before.  The concept was that container extensions could be
better implemented if the container used some sort of event model for
lifecycle and deployment actions.

As soon as I finish these finals, I'll start thinking about it more.

> As for now, I would suggest that your client is not so "greedy".

Yes, "for now"  But I think that in any case, such solutions are just a
hack waiting for a the better solution of "Service Availability" or
better startup control.

-- 
 jaaron  <http://jadetower.org>


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


Re: [merlin] fine grain component startup control

Posted by Niclas Hedhman <ni...@hedhman.org>.
On Tuesday 09 December 2003 06:29, Farr, Aaron wrote:
> 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.  

IMHO, No, we don't need to expand the notion of dependency.
We need to remove the "static assembly" and introduce a "Service Availability" 
contract. 

This will allow services to "come and go" very much independently of 
everything else.

In your case, "JMS Client" would make a call like;

servicemanager.addServiceListener( JMSService.ROLE, this );

and have the methods

public void serviceAdded( ServiceEvent event );
public void serviceRemoved( ServiceEvent event );

instead of doing the

servicemanager.lookup( JMSService.ROLE );


Making sense?

As for now, I would suggest that your client is not so "greedy".

You claim it needs the "JMS Server" early, but I don't understand why is that 
a requirement.
Create a separate thread, and start it in start(), and from there you should 
be able to handle this "inconvenience" for now.


Cheers,
Niclas

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


Re: [merlin] fine grain component startup control

Posted by Timothy Bennett <ex...@comcast.net>.
Farr, Aaron wrote:

> 
> 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.
> 

Same issue if you have database server that is a component (e.g. 
hsqldb), and other components that need to connect to a database during 
the component lifecycle startup (e.g. database connection pooling 
component).

I agree, Aaron, we need something.  I've run into this a number of times...



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