jdk/src/java.desktop/unix/classes/sun/awt/X11/XRootWindow.java
changeset 31169 0647b79041f2
parent 25859 3317bb8137f4
equal deleted inserted replaced
31168:3b8f5ca8938f 31169:0647b79041f2
    29  * This class represents AWT application root window functionality.
    29  * This class represents AWT application root window functionality.
    30  * Object of this class is singleton, all window reference it to have
    30  * Object of this class is singleton, all window reference it to have
    31  * common logical ancestor
    31  * common logical ancestor
    32  */
    32  */
    33 class XRootWindow extends XBaseWindow {
    33 class XRootWindow extends XBaseWindow {
    34     private static XRootWindow xawtRootWindow = null;
    34     private static class LazyHolder {
    35     static XRootWindow getInstance() {
    35         private static final XRootWindow xawtRootWindow;
    36         XToolkit.awtLock();
    36 
    37         try {
    37         static {
    38             if (xawtRootWindow == null) {
    38             XToolkit.awtLock();
       
    39             try {
    39                 xawtRootWindow = new XRootWindow();
    40                 xawtRootWindow = new XRootWindow();
    40                 xawtRootWindow.init(xawtRootWindow.getDelayedParams().delete(DELAYED));
    41                 xawtRootWindow.init(xawtRootWindow.getDelayedParams().delete(DELAYED));
       
    42             } finally {
       
    43                 XToolkit.awtUnlock();
    41             }
    44             }
    42             return xawtRootWindow;
       
    43         } finally {
       
    44             XToolkit.awtUnlock();
       
    45         }
    45         }
       
    46 
       
    47     }
       
    48     static XRootWindow getInstance() {
       
    49         return LazyHolder.xawtRootWindow;
    46     }
    50     }
    47 
    51 
    48     private XRootWindow() {
    52     private XRootWindow() {
    49         super(new XCreateWindowParams(new Object[] { DELAYED, Boolean.TRUE,
    53         super(new XCreateWindowParams(new Object[] { DELAYED, Boolean.TRUE,
    50                                                      EVENT_MASK, XConstants.StructureNotifyMask }));
    54                                                      EVENT_MASK, XConstants.StructureNotifyMask }));