Fix issue found by spotbugs
@@ -78,9 +78,9 @@ public class KubernetesLookup extends AbstractLookup {
private boolean initialize() {
if (kubernetesInfo == null || (isSpringIncluded && !kubernetesInfo.isSpringActive)) {
initLock.lock();
+ try {
boolean isSpringActive = isSpringActive();
if (kubernetesInfo == null || (!kubernetesInfo.isSpringActive && isSpringActive)) {
- try {
KubernetesInfo info = new KubernetesInfo();
KubernetesClient client = null;
info.isSpringActive = isSpringActive;
@@ -152,11 +152,11 @@ public class KubernetesLookup extends AbstractLookup {
kubernetesInfo = info;
}
+ }
} finally {
initLock.unlock();
}
}
- }
return kubernetesInfo != null;
}
