/** Destroy the wrapper. This is called when the bundle is stopped. */ protected void close() { valid = false; /* invalidate context */ final ServiceRegistry registry = framework.getServiceRegistry(); registry.removeAllServiceListeners(this); framework.removeAllListeners(this); /* service's registered by the bundle, if any, are unregistered. */ registry.unregisterServices(this); /* service's used by the bundle, if any, are released. */ registry.releaseServicesInUse(this); synchronized (contextLock) { servicesInUse = null; } }