Synchronize this lazy initialization is showing in sonar I want to solve this problem by static class holder idiom singleton pattern so how will make in static class holder idiom singleton pattern
public final class ContainerFactory {
private static final int SPLIT_PANE = 1;
private static final int TABBED_PANE = 2;
private static TopLevelContainer Container = null;
public static TopLevelContainer getTopLevelContainer()
{
if(Container == null)
{
int containerType = Integer.parseInt(System.getProperty("NUEVO_CONTAINER", "1"));
switch(containerType)
{
case SPLIT_PANE:
Container = new SplitPaneContainer();
break;
case TABBED_PANE:
Container = new TabbedPaneContainer();
break;
}
}
return Container;
}
}