Browse Source

线程安全问题

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

6
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;
@ -84,9 +84,13 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
public static final DesignerFrameFileDealerPane getInstance() { public static final DesignerFrameFileDealerPane getInstance() {
if (THIS == null) {
synchronized (DesignerFrameFileDealerPane.class) {
if (THIS == null) { if (THIS == null) {
THIS = new DesignerFrameFileDealerPane(); THIS = new DesignerFrameFileDealerPane();
} }
}
}
return THIS; return THIS;
} }

8
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;
@ -83,14 +83,18 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
* @return * @return
*/ */
public static EastRegionContainerPane getInstance() { public static EastRegionContainerPane getInstance() {
if (THIS == null) {
synchronized (EastRegionContainerPane.class) {
if (THIS == null) { if (THIS == null) {
THIS = new EastRegionContainerPane(); THIS = new EastRegionContainerPane();
THIS.setLastContainerWidth(DesignerEnvManager.getEnvManager().getLastEastRegionContainerWidth()); 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"));

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

@ -68,13 +68,17 @@ public class CellElementPropertyPane extends DockingView {
public synchronized static CellElementPropertyPane getInstance() { public synchronized static CellElementPropertyPane getInstance() {
if (singleton == null) {
synchronized (CellElementPropertyPane.class) {
if (singleton == null) { if (singleton == null) {
singleton = new CellElementPropertyPane(); 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