I have some problems to unget remote OSGi services over ECF. When I close my application I perform an unget service method call:
public void ungetRemoteService(ID[] idFilter, String serviceName,
String filter) throws ECFException, InvalidSyntaxException {
IRemoteServiceContainerAdapter remoteServiceContainerAdapter = (IRemoteServiceContainerAdapter) this.containter
.getAdapter(IRemoteServiceContainerAdapter.class);
IRemoteServiceReference[] refs = remoteServiceContainerAdapter
.getRemoteServiceReferences(idFilter, serviceName, filter);
if (refs != null) {
// unget the remote service
for (int serviceNumber = 0; serviceNumber < refs.length; serviceNumber++) {
remoteServiceContainerAdapter
.ungetRemoteService(refs[serviceNumber]);
}
}
}
But unfortunatelly this doesn't work because next time I log in one additional service is available. So after 10 logins I've got 10 equal services registered for the same client. Is this again the containerID and rosterID problem? I mean while retrieving the IRemoteServiceReferences:
IRemoteServiceReference[] refs = remoteServiceContainerAdapter
.getRemoteServiceReferences(idFilter, serviceName, filter);
I provide as filterIDs an array with roster IDs. Could this be the source of the problem?
Regards,
Eugen