Browse Source

线程安全问题

master
zack 6 years ago
parent
commit
ed6a4965c0
  1. 12
      designer-base/src/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  2. 12
      designer-base/src/com/fr/design/mainframe/EastRegionContainerPane.java
  3. 12
      designer-realize/src/com/fr/design/mainframe/CellElementPropertyPane.java

12
designer-base/src/com/fr/design/mainframe/DesignerFrameFileDealerPane.java

@ -53,7 +53,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
private static final String FILE = "file"; private static final String FILE = "file";
private static DesignerFrameFileDealerPane THIS; private static volatile DesignerFrameFileDealerPane THIS;
private CardLayout card; private CardLayout card;
@ -81,11 +81,15 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
selectedOperation.refresh(); selectedOperation.refresh();
} }
public static final DesignerFrameFileDealerPane getInstance() { public static final DesignerFrameFileDealerPane getInstance() {
if (THIS == null) { if (THIS == null) {
THIS = new DesignerFrameFileDealerPane(); synchronized (DesignerFrameFileDealerPane.class) {
if (THIS == null) {
THIS = new DesignerFrameFileDealerPane();
}
}
} }
return THIS; return THIS;
} }

12
designer-base/src/com/fr/design/mainframe/EastRegionContainerPane.java

@ -30,7 +30,7 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
public class EastRegionContainerPane extends UIEastResizableContainer { public class EastRegionContainerPane extends UIEastResizableContainer {
private static EastRegionContainerPane THIS; private static volatile EastRegionContainerPane THIS;
private Map<String, PropertyItem> propertyItemMap; private Map<String, PropertyItem> propertyItemMap;
private CardLayout propertyCard; private CardLayout propertyCard;
private JPanel leftPane; private JPanel leftPane;
@ -84,13 +84,17 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
*/ */
public static EastRegionContainerPane getInstance() { public static EastRegionContainerPane getInstance() {
if (THIS == null) { if (THIS == null) {
THIS = new EastRegionContainerPane(); synchronized (EastRegionContainerPane.class) {
THIS.setLastContainerWidth(DesignerEnvManager.getEnvManager().getLastEastRegionContainerWidth()); if (THIS == null) {
THIS = new EastRegionContainerPane();
THIS.setLastContainerWidth(DesignerEnvManager.getEnvManager().getLastEastRegionContainerWidth());
}
}
} }
return THIS; return THIS;
} }
public EastRegionContainerPane() { private EastRegionContainerPane() {
super(); super();
initPropertyItemList(); initPropertyItemList();
defaultPane = getDefaultPane(Inter.getLocText("FR-Designer_No_Settings_Available")); defaultPane = getDefaultPane(Inter.getLocText("FR-Designer_No_Settings_Available"));

12
designer-realize/src/com/fr/design/mainframe/CellElementPropertyPane.java

@ -65,16 +65,20 @@ public class CellElementPropertyPane extends DockingView {
} }
}); });
} }
public synchronized static CellElementPropertyPane getInstance() { public synchronized static CellElementPropertyPane getInstance() {
if (singleton == null) { if (singleton == null) {
singleton = new CellElementPropertyPane(); synchronized (CellElementPropertyPane.class) {
if (singleton == null) {
singleton = new CellElementPropertyPane();
}
}
} }
return singleton; return singleton;
} }
private static CellElementPropertyPane singleton; private static volatile CellElementPropertyPane singleton;
private CellElementEditPane cellElementEditPane; private CellElementEditPane cellElementEditPane;

Loading…
Cancel
Save