Bulbuk,
Since a few days we are switching our Project from ECM to Phoenix 4.0.1. The
first components we tested worked just fine but now we seem to hit some
subtle semantic differences that cause us some trouble:
1. ServiceManager.lookup() seems to deliver a proxy instead of the
requested component. The problem is that the component implements
an interface (Executable) that the proxy doesn't implement.
So we don't get to know that we should call the execute method
anymore and the component doesn't do its work anymore.
I suppose that the proxy could be executed (with proxy.execute())
and would then call component.execute(). But how do I know???
Easy, make the service interface extend Executable. OR have another
interface that extends the Executable interface and your former old
service interface. Lookup that one instead. Alternativel I think there
is a way that a particular block can declare multiple service interfaces.
2. All components are instantiated and even started before lookup.
This seems to block everything else because the start (or execute)
methods of my components usually do a lot of work and are sometimes
supposed to be started in an own thread (which would exist when
lookup is done).
Take a look the the new lifecycle-demo.sar files in avalon-apps/demo.
It should show you how it works. Rule of thumb : don;t block the
initialise of start methods. Phoenix needs control back.
3. How am I able to get more than one instance of the same component
with the same role? I need this to run the same component in
multiple threads. Only the implementation of the component could
decide that the component is threadsafe (but usually it is NOT).
So how can I get multiple instances of a (non) threadsafe
component?
Best thing would be to have service that is a factory to that comonent...
// this one is not a block.
interface MyComp {
void somePotentiallyThreadUnsafeMethod();
}
// this one is the block.
interface MyCompFactory {
MyComp getOrMakeMyComp();
}
- Paul
--
To unsubscribe, e-mail: <mailto:avalon-users-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-users-help@;jakarta.apache.org>