LOGGER.error("failed to establish connection (Service-Descriptor: "
+ desc + ")");
}
LOGGER.debug("getting remote service ({})", desc);
URI suri = this.getAddress(desc, true);
RemoteServiceReference rref = null;
int retries = 5;
while (rref == null) {
rref = remoteOSGiSvc.getRemoteServiceReference(suri);
if (rref == null) {
LOGGER.debug(
"remote service unavailable ({}, #retries: {})",
desc, retries--);
try {
Thread.sleep(1000);
} catch (InterruptedException ie) {
// Ignore
}
continue;
}
}
active.add(desc);
Object obj = remoteOSGiSvc.getRemoteService(rref);
obj.hashCode();
refByDesc.put(desc, rref);
} else {
stale.remove(desc);
}
}
for (ServiceDescriptor desc : stale) {
LOGGER.debug("ungetting remote service ({})", desc);
active.remove(desc);
RemoteServiceReference rref = refByDesc.remove(desc);
try {
remoteOSGiSvc.ungetRemoteService(rref);
} catch (Exception e) {
/* Ignore */
}