Using time-consuming services from a component

"David Leangen" <[email protected]>
Newsgroups gmane.comp.jakarta.avalon.user
Message-ID <[email protected]>
Hello!

I have created a component, as explained in the tutorials. Let's call it
"Component". Component has two services, ServiceA and ServiceB. Both of
these services take a while to complete, and should be executed in sequence,
since ServiceB depends on the completion of ServiceA.

I declare my services like this:

  public Interface ServiceA
  {
    Object getStuff();
  }

  public Interface ServiceAObject extends IServiceA, runnable
  {
    void setStuff(Object stuff);
  }

  public Class ServiceAImpl implements ServiceAObject
  {
    private Object stuff;

    Object getStuff()
    {
      return stuff;
    }

    void setStuff(Object stuff)
    {
      this.stuff = stuff;
    }

  }


Same idea for ServiceB.

My Avalon service providers implement ServiceA and ServiceB respectively.


My questions are:

1. When I was using only ServiceA, I only had to make a call to
   getStuff() in initialize(). At that time, I didn't really
   stop to think about the mechanism. I would like to know
   what actually fires off the service.

2. How can I get Component to wait for the completion of
   ServiceA so I can fire ServiceB?


I tried making a direct call to serviceA.start(), but that didn't work. I
don't think that I should be making my service providers Runnable.

So, there's something I'm not getting here...


Can anybody help me understand this, please?


Thanks so much!!
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.