}
for (int i = 0; i < services.length; i++) {
DependencyService ds = (DependencyService) services[i];
if (makeUnavailable) {
ds.dependencyUnavailable(this);
// when the dependency is optional or the dependency is instance bound and the component is instantiated (and the dependency is required)
// then remove is invoked. In other cases the removed has been when the component was unconfigured.
if (!isRequired() || (ds.isInstantiated() && isInstanceBound())) {
invokeRemoved(ds, ref, service);
}