You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Vladimir Kirichenko <ki...@silverpoint.com.ua> on 2002/12/20 11:43:16 UTC

Q: Dependent Initialization

Hi, All!

There is one question.

How could I make dependent initialization of 2 services. I.e if service A
needs the live instance of service B in his initialization phase?
This is a problem because of uncontrolled order of service initialization.
May be this is reason to add to framework new interface between
initialization and start phases with one method
setup()? This allows to have a phase where services can interact with live
instances of other services.

--
With Best Regards,
Vladimir Kirichenko




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Q: Dependent Initialization

Posted by Greg Steuck <gr...@nest.cx>.
>>>>> "Berin" == Berin Loritsch <bl...@citi-us.com> writes:

    Berin> Good question.  I have never written anything with a circular
    Berin> dependency.  In general that's a *really* bad practice.
    Berin> Unfortunately you can't keep people from shooting themselves
    Berin> in the foot.

This particular kind of self destructive behavior can be easily
prevented if dependencies are explicit. In fact, Phoenix checks the deps
graph for loops. A similar thing could be done in Fortress, but it will
have to be an in-progress check as opposed to pre-requisite check.

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Q: Dependent Initialization

Posted by Berin Loritsch <bl...@citi-us.com>.
> From: greg@home.nest.cx [mailto:greg@home.nest.cx]On Behalf Of Greg
> 
> >>>>> "Berin" == Berin Loritsch <bl...@citi-us.com> writes:
> 
>     Berin> In Fortress, if any component needs another one during init
>     Berin> time, then the dependent component is initialized 
> on demand.
>     Berin> Otherwise, components are initialized according to 
> the order
>     Berin> in the backing map.  The approach worked well for the ECM,
>     Berin> and it was brought forward to Fortress.
> 
> Berin, I always ment to aks that: what does Fortress do to prevent
> initialization loops? ECM simply went into an infinite loop AFAIR.


Good question.  I have never written anything with a circular dependency.
In general that's a *really* bad practice.  Unfortunately you can't keep
people from shooting themselves in the foot.

I'm not sure if I have infinite loop protection in there or not.

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Q: Dependent Initialization

Posted by Greg Steuck <gr...@nest.cx>.
>>>>> "Berin" == Berin Loritsch <bl...@citi-us.com> writes:

    Berin> In Fortress, if any component needs another one during init
    Berin> time, then the dependent component is initialized on demand.
    Berin> Otherwise, components are initialized according to the order
    Berin> in the backing map.  The approach worked well for the ECM,
    Berin> and it was brought forward to Fortress.

Berin, I always ment to aks that: what does Fortress do to prevent
initialization loops? ECM simply went into an infinite loop AFAIR.

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Q: Dependent Initialization

Posted by Berin Loritsch <bl...@citi-us.com>.
> From: greg@home.nest.cx [mailto:greg@home.nest.cx]On Behalf Of Greg
> 
>     Vladimir> May be this is reason to add to framework new interface
>     Vladimir> between initialization and start phases with one method
>     Vladimir> setup()? This allows to have a phase where services can
>     Vladimir> interact with live instances of other services.
> 
> If I understand you correctly, all you need to do in e.g. Phoenix is
> specify that B should be provided to A. Then B will be fully 
> initialized
> and started by the time A gets to use it. Does that answer your
> question?


In Fortress, if any component needs another one during init time, then
the dependent component is initialized on demand.  Otherwise, components
are initialized according to the order in the backing map.  The approach
worked well for the ECM, and it was brought forward to Fortress.

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Q: Dependent Initialization

Posted by Greg Steuck <gr...@nest.cx>.
>>>>> "Vladimir" == Vladimir Kirichenko <ki...@silverpoint.com.ua> writes:

    Vladimir> How could I make dependent initialization of 2
    Vladimir> services. I.e if service A needs the live instance of
    Vladimir> service B in his initialization phase?  This is a problem
    Vladimir> because of uncontrolled order of service initialization.
    >> Why do you say it is uncontrolled? Which particular container do
    >> you have in mind?

    Vladimir> I dont use any of them. I cannot use them in my project
    Vladimir> because of some features of it. I use framework only with
    Vladimir> some kind of my own container.

In such a case your container is responsible for initializing the
components in the right order. Take a look at how other containers
achieve it. Alternatively you could talk to the list and maybe we
together can figure out how you could take advantage of the existing
containers hence save your time. Even if the current containers can't be
used in your project, your input may help us shape the future containers
to cover your needs.

Bye
Greg

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Q: Dependent Initialization

Posted by Vladimir Kirichenko <ki...@silverpoint.com.ua>.
>     Vladimir> How could I make dependent initialization of 2
>     Vladimir> services. I.e if service A needs the live instance of
>     Vladimir> service B in his initialization phase?  This is a problem
>     Vladimir> because of uncontrolled order of service initialization.
> Why do you say it is uncontrolled? Which particular container do you
> have in mind?

I dont use any of them. I cannot use them in my project because of some
features of it. I use framework only with some kind of my own container.


>     Vladimir> May be this is reason to add to framework new interface
>     Vladimir> between initialization and start phases with one method
>     Vladimir> setup()? This allows to have a phase where services can
>     Vladimir> interact with live instances of other services.
> If I understand you correctly, all you need to do in e.g. Phoenix is
> specify that B should be provided to A. Then B will be fully initialized
> and started by the time A gets to use it. Does that answer your
> question?

Yes. But this feature provided by particular container only. But the qustion
is about initialization phases that framework is responsible for.

--
Vladimir


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Q: Dependent Initialization

Posted by Greg Steuck <gr...@nest.cx>.
>>>>> "Vladimir" == Vladimir Kirichenko <ki...@silverpoint.com.ua> writes:

    Vladimir> How could I make dependent initialization of 2
    Vladimir> services. I.e if service A needs the live instance of
    Vladimir> service B in his initialization phase?  This is a problem
    Vladimir> because of uncontrolled order of service initialization.

Why do you say it is uncontrolled? Which particular container do you
have in mind?

    Vladimir> May be this is reason to add to framework new interface
    Vladimir> between initialization and start phases with one method
    Vladimir> setup()? This allows to have a phase where services can
    Vladimir> interact with live instances of other services.

If I understand you correctly, all you need to do in e.g. Phoenix is
specify that B should be provided to A. Then B will be fully initialized
and started by the time A gets to use it. Does that answer your
question?

Bye
Greg

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>