On 8/17/11 11:07, Donald Whytock wrote:
Hi all...
I've been having a problem with method overrides in Felix.
Generalized scenario:
Two bundles: BundleA and BundleB.
BundleB's ActivatorB extends BundleA's ActivatorA. ActivatorB does
not define a start() method.
BundleB's ServiceImplB extends BundleA's ServiceImplA.
ActivatorA is abstract and has an abstract method getServiceImpl(),
which returns a ServiceImplA. ActivatorB implements this method,
returning an instance of ServiceImplB.
ServiceImplA is abstract and has a non-abstract method showStatus().
ServiceImplB overrides showStatus().
BundleA is resolved and does not have a Bundle-Activator. BundleB is
resolved and has ActivatorB as a Bundle-Activator.
When BundleB is started, ActivatorA.start() instantiates and starts an
extension of ServiceTracker, myServiceTracker.
myServiceTracker.addingReference() calls getServiceImpl() for a
ServiceImpA and calls showStatus() on it.
If ServiceImplB.showStatus() calls super.showStatus(),
ServiceImplB.showStatus() is called. If ServiceImplB.showStatus()
does not call super.showStatus(), ServiceImplA.showStatus() is called.
Are you saying that invoking ServiceImplB.showStatus() bypasses the code
in ServiceImplB.showStatus() and directly goes to ServiceImplA.showStatus()?
I don't believe this is normal Java behavior. I believe in a
command-line-JVM situation, ServiceImplB.showStatus() would always be
called, whether or not it called super.showStatus(). So is this an
idiosyncracy of classloaders in Felix?
I doubt it. I would imagine something else is going on. If you want to
email me a simple working example, I can take a look at it.
-> richard
Don
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]