for (int i = services.size() - 1; i >= 0; i--) {
Service service = (Service) services.get(i);
manager.remove(service);
// remove any state listeners that are still registered
if (service instanceof ServiceImpl) {
ServiceImpl si = (ServiceImpl) service;
si.removeStateListeners();
}
}
}