I have a situation where I need to load a list of providers only once . So I have used synchronized block . But it fails in multiclustered environment in weblogic . Is there any way to handle it . This snippet of code works fine in single cluster .
public class AdditionalInfoImplProvider
{
private volatile boolean isLoaded = false;
private void ensureProviderLoaded()
{
if (!isLoaded) {
synchronized (this) {
if (!isLoaded) {
// Load Provider
isLoaded = true;
}
}
}
}
}