Hi

I'm using the iPOJO WhiteBoard handler like this:

public final void onArrival(final ServiceReference ref) {
final IWebModule module = (IWebModule) this.context.getService(ref);
synchronized (lock) {
        //do something with the module service
}
this.context.ungetService(ref);
}

public final void onDeparture(final ServiceReference ref) {
final IWebModule module = (IWebModule) this.context.getService(ref);
synchronized (lock) {
        //do something with the module service
}
this.context.ungetService(ref);
}


>From what I see, I can only have the ServiceReference injected.
To get the real service object, I also need a BundleContext.
And using getService and ungetService.
Which make the code "Un-POJO".

And the above code, in onDeparture method,
this.context.getService(ref); returns null.
So there is something wrong.

Is there a way to get the POJO service directly without messing up with
ServiceReference? Or any best practice using iPOJO WhiteBoard.

Regards
LongkerDandy


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to