Java 类sun.misc.PerformanceLogger 实例源码

项目:openjdk-jdk7u-jdk    文件:XToolkit.java   
public XToolkit() {
    super();
    if (PerformanceLogger.loggingEnabled()) {
        PerformanceLogger.setTime("XToolkit construction");
    }

    if (!GraphicsEnvironment.isHeadless()) {
        String mainClassName = null;

        StackTraceElement trace[] = (new Throwable()).getStackTrace();
        int bottom = trace.length - 1;
        if (bottom >= 0) {
            mainClassName = trace[bottom].getClassName();
        }
        if (mainClassName == null || mainClassName.equals("")) {
            mainClassName = "AWT";
        }
        awtAppClassName = getCorrectXIDString(mainClassName);

        init();
        XWM.init();
        SunToolkit.setDataTransfererClassName(DATA_TRANSFERER_CLASS_NAME);
        toolkitThread = AccessController.doPrivileged(new PrivilegedAction<Thread>() {
            @Override
            public Thread run() {
                Thread thread = new Thread(ThreadGroupUtils.getRootThreadGroup(), XToolkit.this, "AWT-XAWT");
                thread.setContextClassLoader(null);
                thread.setPriority(Thread.NORM_PRIORITY + 1);
                thread.setDaemon(true);
                return thread;
            }
        });
        toolkitThread.start();
    }
}
项目:OpenJSharp    文件:WToolkit.java   
public WToolkit() {
    // Startup toolkit threads
    if (PerformanceLogger.loggingEnabled()) {
        PerformanceLogger.setTime("WToolkit construction");
    }

    sun.java2d.Disposer.addRecord(anchor, new ToolkitDisposer());

    /*
     * Fix for 4701990.
     * AWTAutoShutdown state must be changed before the toolkit thread
     * starts to avoid race condition.
     */
    AWTAutoShutdown.notifyToolkitThreadBusy();

    // Find a root TG and attach Appkit thread to it
    ThreadGroup rootTG = AccessController.doPrivileged(
            (PrivilegedAction<ThreadGroup>) ThreadGroupUtils::getRootThreadGroup);
    if (!startToolkitThread(this, rootTG)) {
        Thread toolkitThread = new Thread(rootTG, this, "AWT-Windows");
        toolkitThread.setDaemon(true);
        toolkitThread.start();
    }

    try {
        synchronized(this) {
            while(!inited) {
                wait();
            }
        }
    } catch (InterruptedException x) {
        // swallow the exception
    }

    // Enabled "live resizing" by default.  It remains controlled
    // by the native system though.
    setDynamicLayout(true);

    areExtraMouseButtonsEnabled = Boolean.parseBoolean(System.getProperty("sun.awt.enableExtraMouseButtons", "true"));
    //set system property if not yet assigned
    System.setProperty("sun.awt.enableExtraMouseButtons", ""+areExtraMouseButtonsEnabled);
    setExtraMouseButtonsEnabledNative(areExtraMouseButtonsEnabled);
}
项目:jdk8u-jdk    文件:WToolkit.java   
public WToolkit() {
    // Startup toolkit threads
    if (PerformanceLogger.loggingEnabled()) {
        PerformanceLogger.setTime("WToolkit construction");
    }

    sun.java2d.Disposer.addRecord(anchor, new ToolkitDisposer());

    /*
     * Fix for 4701990.
     * AWTAutoShutdown state must be changed before the toolkit thread
     * starts to avoid race condition.
     */
    AWTAutoShutdown.notifyToolkitThreadBusy();

    // Find a root TG and attach Appkit thread to it
    ThreadGroup rootTG = AccessController.doPrivileged(
            (PrivilegedAction<ThreadGroup>) ThreadGroupUtils::getRootThreadGroup);
    if (!startToolkitThread(this, rootTG)) {
        Thread toolkitThread = new Thread(rootTG, this, "AWT-Windows");
        toolkitThread.setDaemon(true);
        toolkitThread.start();
    }

    try {
        synchronized(this) {
            while(!inited) {
                wait();
            }
        }
    } catch (InterruptedException x) {
        // swallow the exception
    }

    // Enabled "live resizing" by default.  It remains controlled
    // by the native system though.
    setDynamicLayout(true);

    areExtraMouseButtonsEnabled = Boolean.parseBoolean(System.getProperty("sun.awt.enableExtraMouseButtons", "true"));
    //set system property if not yet assigned
    System.setProperty("sun.awt.enableExtraMouseButtons", ""+areExtraMouseButtonsEnabled);
    setExtraMouseButtonsEnabledNative(areExtraMouseButtonsEnabled);
}
项目:jdk8u_jdk    文件:WToolkit.java   
public WToolkit() {
    // Startup toolkit threads
    if (PerformanceLogger.loggingEnabled()) {
        PerformanceLogger.setTime("WToolkit construction");
    }

    sun.java2d.Disposer.addRecord(anchor, new ToolkitDisposer());

    /*
     * Fix for 4701990.
     * AWTAutoShutdown state must be changed before the toolkit thread
     * starts to avoid race condition.
     */
    AWTAutoShutdown.notifyToolkitThreadBusy();

    // Find a root TG and attach Appkit thread to it
    ThreadGroup rootTG = AccessController.doPrivileged(
            (PrivilegedAction<ThreadGroup>) ThreadGroupUtils::getRootThreadGroup);
    if (!startToolkitThread(this, rootTG)) {
        Thread toolkitThread = new Thread(rootTG, this, "AWT-Windows");
        toolkitThread.setDaemon(true);
        toolkitThread.start();
    }

    try {
        synchronized(this) {
            while(!inited) {
                wait();
            }
        }
    } catch (InterruptedException x) {
        // swallow the exception
    }

    // Enabled "live resizing" by default.  It remains controlled
    // by the native system though.
    setDynamicLayout(true);

    areExtraMouseButtonsEnabled = Boolean.parseBoolean(System.getProperty("sun.awt.enableExtraMouseButtons", "true"));
    //set system property if not yet assigned
    System.setProperty("sun.awt.enableExtraMouseButtons", ""+areExtraMouseButtonsEnabled);
    setExtraMouseButtonsEnabledNative(areExtraMouseButtonsEnabled);
}
项目:lookaside_java-1.8.0-openjdk    文件:WToolkit.java   
public WToolkit() {
    // Startup toolkit threads
    if (PerformanceLogger.loggingEnabled()) {
        PerformanceLogger.setTime("WToolkit construction");
    }

    sun.java2d.Disposer.addRecord(anchor, new ToolkitDisposer());

    /*
     * Fix for 4701990.
     * AWTAutoShutdown state must be changed before the toolkit thread
     * starts to avoid race condition.
     */
    AWTAutoShutdown.notifyToolkitThreadBusy();

    // Find a root TG and attach Appkit thread to it
    ThreadGroup rootTG = AccessController.doPrivileged(
            (PrivilegedAction<ThreadGroup>) ThreadGroupUtils::getRootThreadGroup);
    if (!startToolkitThread(this, rootTG)) {
        Thread toolkitThread = new Thread(rootTG, this, "AWT-Windows");
        toolkitThread.setDaemon(true);
        toolkitThread.start();
    }

    try {
        synchronized(this) {
            while(!inited) {
                wait();
            }
        }
    } catch (InterruptedException x) {
        // swallow the exception
    }

    // Enabled "live resizing" by default.  It remains controlled
    // by the native system though.
    setDynamicLayout(true);

    areExtraMouseButtonsEnabled = Boolean.parseBoolean(System.getProperty("sun.awt.enableExtraMouseButtons", "true"));
    //set system property if not yet assigned
    System.setProperty("sun.awt.enableExtraMouseButtons", ""+areExtraMouseButtonsEnabled);
    setExtraMouseButtonsEnabledNative(areExtraMouseButtonsEnabled);
}
项目:infobip-open-jdk-8    文件:WToolkit.java   
public WToolkit() {
    // Startup toolkit threads
    if (PerformanceLogger.loggingEnabled()) {
        PerformanceLogger.setTime("WToolkit construction");
    }

    sun.java2d.Disposer.addRecord(anchor, new ToolkitDisposer());

    /*
     * Fix for 4701990.
     * AWTAutoShutdown state must be changed before the toolkit thread
     * starts to avoid race condition.
     */
    AWTAutoShutdown.notifyToolkitThreadBusy();

    // Find a root TG and attach Appkit thread to it
    ThreadGroup rootTG = AccessController.doPrivileged(
            (PrivilegedAction<ThreadGroup>) ThreadGroupUtils::getRootThreadGroup);
    if (!startToolkitThread(this, rootTG)) {
        Thread toolkitThread = new Thread(rootTG, this, "AWT-Windows");
        toolkitThread.setDaemon(true);
        toolkitThread.start();
    }

    try {
        synchronized(this) {
            while(!inited) {
                wait();
            }
        }
    } catch (InterruptedException x) {
        // swallow the exception
    }

    // Enabled "live resizing" by default.  It remains controlled
    // by the native system though.
    setDynamicLayout(true);

    areExtraMouseButtonsEnabled = Boolean.parseBoolean(System.getProperty("sun.awt.enableExtraMouseButtons", "true"));
    //set system property if not yet assigned
    System.setProperty("sun.awt.enableExtraMouseButtons", ""+areExtraMouseButtonsEnabled);
    setExtraMouseButtonsEnabledNative(areExtraMouseButtonsEnabled);
}
项目:jdk8u-dev-jdk    文件:WToolkit.java   
public WToolkit() {
    // Startup toolkit threads
    if (PerformanceLogger.loggingEnabled()) {
        PerformanceLogger.setTime("WToolkit construction");
    }

    sun.java2d.Disposer.addRecord(anchor, new ToolkitDisposer());

    /*
     * Fix for 4701990.
     * AWTAutoShutdown state must be changed before the toolkit thread
     * starts to avoid race condition.
     */
    AWTAutoShutdown.notifyToolkitThreadBusy();

    // Find a root TG and attach Appkit thread to it
    ThreadGroup rootTG = AccessController.doPrivileged(
            (PrivilegedAction<ThreadGroup>) ThreadGroupUtils::getRootThreadGroup);
    if (!startToolkitThread(this, rootTG)) {
        Thread toolkitThread = new Thread(rootTG, this, "AWT-Windows");
        toolkitThread.setDaemon(true);
        toolkitThread.start();
    }

    try {
        synchronized(this) {
            while(!inited) {
                wait();
            }
        }
    } catch (InterruptedException x) {
        // swallow the exception
    }

    // Enabled "live resizing" by default.  It remains controlled
    // by the native system though.
    setDynamicLayout(true);

    areExtraMouseButtonsEnabled = Boolean.parseBoolean(System.getProperty("sun.awt.enableExtraMouseButtons", "true"));
    //set system property if not yet assigned
    System.setProperty("sun.awt.enableExtraMouseButtons", ""+areExtraMouseButtonsEnabled);
    setExtraMouseButtonsEnabledNative(areExtraMouseButtonsEnabled);
}
项目:jdk7-jdk    文件:WToolkit.java   
public WToolkit() {
    // Startup toolkit threads
    if (PerformanceLogger.loggingEnabled()) {
        PerformanceLogger.setTime("WToolkit construction");
    }

    sun.java2d.Disposer.addRecord(anchor, new ToolkitDisposer());

    /*
     * Fix for 4701990.
     * AWTAutoShutdown state must be changed before the toolkit thread
     * starts to avoid race condition.
     */
    AWTAutoShutdown.notifyToolkitThreadBusy();

    if (!startToolkitThread(this)) {
        Thread toolkitThread = new Thread(this, "AWT-Windows");
        toolkitThread.setDaemon(true);
        toolkitThread.start();
    }

    try {
        synchronized(this) {
            while(!inited) {
                wait();
            }
        }
    } catch (InterruptedException x) {
        // swallow the exception
    }

    SunToolkit.setDataTransfererClassName(DATA_TRANSFERER_CLASS_NAME);

    // Enabled "live resizing" by default.  It remains controlled
    // by the native system though.
    setDynamicLayout(true);

    areExtraMouseButtonsEnabled = Boolean.parseBoolean(System.getProperty("sun.awt.enableExtraMouseButtons", "true"));
    //set system property if not yet assigned
    System.setProperty("sun.awt.enableExtraMouseButtons", ""+areExtraMouseButtonsEnabled);
    setExtraMouseButtonsEnabledNative(areExtraMouseButtonsEnabled);
}
项目:jdk7-jdk    文件:MToolkit.java   
public MToolkit() {
    super();
    if (PerformanceLogger.loggingEnabled()) {
        PerformanceLogger.setTime("MToolkit construction");
    }
    if (!GraphicsEnvironment.isHeadless()) {
        String mainClassName = null;

        StackTraceElement trace[] = (new Throwable()).getStackTrace();
        int bottom = trace.length - 1;
        if (bottom >= 0) {
            mainClassName = trace[bottom].getClassName();
        }
        if (mainClassName == null || mainClassName.equals("")) {
            mainClassName = "AWT";
        }

        init(mainClassName);
        //SunToolkit.setDataTransfererClassName(DATA_TRANSFERER_CLASS_NAME);

        Thread toolkitThread = new Thread(this, "AWT-Motif");
        toolkitThread.setPriority(Thread.NORM_PRIORITY + 1);
        toolkitThread.setDaemon(true);

        PrivilegedAction<Void> a = new PrivilegedAction<Void>() {
            public Void run() {
                ThreadGroup mainTG = Thread.currentThread().getThreadGroup();
                ThreadGroup parentTG = mainTG.getParent();

                while (parentTG != null) {
                    mainTG = parentTG;
                    parentTG = mainTG.getParent();
                }
                Thread shutdownThread = new Thread(mainTG, new Runnable() {
                        public void run() {
                            shutdown();
                        }
                    }, "Shutdown-Thread");
                shutdownThread.setContextClassLoader(null);
                Runtime.getRuntime().addShutdownHook(shutdownThread);
                return null;
            }
        };
        AccessController.doPrivileged(a);

        /*
         * Fix for 4701990.
         * AWTAutoShutdown state must be changed before the toolkit thread
         * starts to avoid race condition.
         */
        AWTAutoShutdown.notifyToolkitThreadBusy();

        toolkitThread.start();
    }
}
项目:jdk7-jdk    文件:XToolkit.java   
public XToolkit() {
    super();
    if (PerformanceLogger.loggingEnabled()) {
        PerformanceLogger.setTime("XToolkit construction");
    }

    if (!GraphicsEnvironment.isHeadless()) {
        String mainClassName = null;

        StackTraceElement trace[] = (new Throwable()).getStackTrace();
        int bottom = trace.length - 1;
        if (bottom >= 0) {
            mainClassName = trace[bottom].getClassName();
        }
        if (mainClassName == null || mainClassName.equals("")) {
            mainClassName = "AWT";
        }
        awtAppClassName = getCorrectXIDString(mainClassName);

        init();
        XWM.init();
        SunToolkit.setDataTransfererClassName(DATA_TRANSFERER_CLASS_NAME);

        PrivilegedAction<Thread> action = new PrivilegedAction() {
            public Thread run() {
                ThreadGroup currentTG = Thread.currentThread().getThreadGroup();
                ThreadGroup parentTG = currentTG.getParent();
                while (parentTG != null) {
                    currentTG = parentTG;
                    parentTG = currentTG.getParent();
                }
                Thread thread = new Thread(currentTG, XToolkit.this, "AWT-XAWT");
                thread.setPriority(Thread.NORM_PRIORITY + 1);
                thread.setDaemon(true);
                return thread;
            }
        };
        toolkitThread = AccessController.doPrivileged(action);
        toolkitThread.start();
    }
}
项目:openjdk-source-code-learn    文件:WToolkit.java   
public WToolkit() {
    // Startup toolkit threads
    if (PerformanceLogger.loggingEnabled()) {
        PerformanceLogger.setTime("WToolkit construction");
    }

    sun.java2d.Disposer.addRecord(anchor, new ToolkitDisposer());

    /*
     * Fix for 4701990.
     * AWTAutoShutdown state must be changed before the toolkit thread
     * starts to avoid race condition.
     */
    AWTAutoShutdown.notifyToolkitThreadBusy();

    if (!startToolkitThread(this)) {
        Thread toolkitThread = new Thread(this, "AWT-Windows");
        toolkitThread.setDaemon(true);
        toolkitThread.start();
    }

    try {
        synchronized(this) {
            while(!inited) {
                wait();
            }
        }
    } catch (InterruptedException x) {
        // swallow the exception
    }

    SunToolkit.setDataTransfererClassName(DATA_TRANSFERER_CLASS_NAME);

    // Enabled "live resizing" by default.  It remains controlled
    // by the native system though.
    setDynamicLayout(true);

    areExtraMouseButtonsEnabled = Boolean.parseBoolean(System.getProperty("sun.awt.enableExtraMouseButtons", "true"));
    //set system property if not yet assigned
    System.setProperty("sun.awt.enableExtraMouseButtons", ""+areExtraMouseButtonsEnabled);
    setExtraMouseButtonsEnabledNative(areExtraMouseButtonsEnabled);
}
项目:openjdk-source-code-learn    文件:MToolkit.java   
public MToolkit() {
    super();
    if (PerformanceLogger.loggingEnabled()) {
        PerformanceLogger.setTime("MToolkit construction");
    }
    if (!GraphicsEnvironment.isHeadless()) {
        String mainClassName = null;

        StackTraceElement trace[] = (new Throwable()).getStackTrace();
        int bottom = trace.length - 1;
        if (bottom >= 0) {
            mainClassName = trace[bottom].getClassName();
        }
        if (mainClassName == null || mainClassName.equals("")) {
            mainClassName = "AWT";
        }

        init(mainClassName);
        //SunToolkit.setDataTransfererClassName(DATA_TRANSFERER_CLASS_NAME);

        Thread toolkitThread = new Thread(this, "AWT-Motif");
        toolkitThread.setPriority(Thread.NORM_PRIORITY + 1);
        toolkitThread.setDaemon(true);

        PrivilegedAction<Void> a = new PrivilegedAction<Void>() {
            public Void run() {
                ThreadGroup mainTG = Thread.currentThread().getThreadGroup();
                ThreadGroup parentTG = mainTG.getParent();

                while (parentTG != null) {
                    mainTG = parentTG;
                    parentTG = mainTG.getParent();
                }
                Thread shutdownThread = new Thread(mainTG, new Runnable() {
                        public void run() {
                            shutdown();
                        }
                    }, "Shutdown-Thread");
                shutdownThread.setContextClassLoader(null);
                Runtime.getRuntime().addShutdownHook(shutdownThread);
                return null;
            }
        };
        AccessController.doPrivileged(a);

        /*
         * Fix for 4701990.
         * AWTAutoShutdown state must be changed before the toolkit thread
         * starts to avoid race condition.
         */
        AWTAutoShutdown.notifyToolkitThreadBusy();

        toolkitThread.start();
    }
}
项目:openjdk-source-code-learn    文件:XToolkit.java   
public XToolkit() {
    super();
    if (PerformanceLogger.loggingEnabled()) {
        PerformanceLogger.setTime("XToolkit construction");
    }

    if (!GraphicsEnvironment.isHeadless()) {
        String mainClassName = null;

        StackTraceElement trace[] = (new Throwable()).getStackTrace();
        int bottom = trace.length - 1;
        if (bottom >= 0) {
            mainClassName = trace[bottom].getClassName();
        }
        if (mainClassName == null || mainClassName.equals("")) {
            mainClassName = "AWT";
        }
        awtAppClassName = getCorrectXIDString(mainClassName);

        init();
        XWM.init();
        SunToolkit.setDataTransfererClassName(DATA_TRANSFERER_CLASS_NAME);

        PrivilegedAction<Thread> action = new PrivilegedAction() {
            public Thread run() {
                ThreadGroup currentTG = Thread.currentThread().getThreadGroup();
                ThreadGroup parentTG = currentTG.getParent();
                while (parentTG != null) {
                    currentTG = parentTG;
                    parentTG = currentTG.getParent();
                }
                Thread thread = new Thread(currentTG, XToolkit.this, "AWT-XAWT");
                thread.setPriority(Thread.NORM_PRIORITY + 1);
                thread.setDaemon(true);
                return thread;
            }
        };
        toolkitThread = AccessController.doPrivileged(action);
        toolkitThread.start();
    }
}
项目:OLD-OpenJDK8    文件:WToolkit.java   
public WToolkit() {
    // Startup toolkit threads
    if (PerformanceLogger.loggingEnabled()) {
        PerformanceLogger.setTime("WToolkit construction");
    }

    sun.java2d.Disposer.addRecord(anchor, new ToolkitDisposer());

    /*
     * Fix for 4701990.
     * AWTAutoShutdown state must be changed before the toolkit thread
     * starts to avoid race condition.
     */
    AWTAutoShutdown.notifyToolkitThreadBusy();

    if (!startToolkitThread(this)) {
        Thread toolkitThread = new Thread(this, "AWT-Windows");
        toolkitThread.setDaemon(true);
        toolkitThread.start();
    }

    try {
        synchronized(this) {
            while(!inited) {
                wait();
            }
        }
    } catch (InterruptedException x) {
        // swallow the exception
    }

    SunToolkit.setDataTransfererClassName(DATA_TRANSFERER_CLASS_NAME);

    // Enabled "live resizing" by default.  It remains controlled
    // by the native system though.
    setDynamicLayout(true);

    areExtraMouseButtonsEnabled = Boolean.parseBoolean(System.getProperty("sun.awt.enableExtraMouseButtons", "true"));
    //set system property if not yet assigned
    System.setProperty("sun.awt.enableExtraMouseButtons", ""+areExtraMouseButtonsEnabled);
    setExtraMouseButtonsEnabledNative(areExtraMouseButtonsEnabled);
}
项目:OLD-OpenJDK8    文件:XToolkit.java   
public XToolkit() {
    super();
    if (PerformanceLogger.loggingEnabled()) {
        PerformanceLogger.setTime("XToolkit construction");
    }

    if (!GraphicsEnvironment.isHeadless()) {
        String mainClassName = null;

        StackTraceElement trace[] = (new Throwable()).getStackTrace();
        int bottom = trace.length - 1;
        if (bottom >= 0) {
            mainClassName = trace[bottom].getClassName();
        }
        if (mainClassName == null || mainClassName.equals("")) {
            mainClassName = "AWT";
        }
        awtAppClassName = getCorrectXIDString(mainClassName);

        init();
        XWM.init();
        SunToolkit.setDataTransfererClassName(DATA_TRANSFERER_CLASS_NAME);

        PrivilegedAction<Thread> action = new PrivilegedAction() {
            public Thread run() {
                ThreadGroup currentTG = Thread.currentThread().getThreadGroup();
                ThreadGroup parentTG = currentTG.getParent();
                while (parentTG != null) {
                    currentTG = parentTG;
                    parentTG = currentTG.getParent();
                }
                Thread thread = new Thread(currentTG, XToolkit.this, "AWT-XAWT");
                thread.setPriority(Thread.NORM_PRIORITY + 1);
                thread.setDaemon(true);
                return thread;
            }
        };
        toolkitThread = AccessController.doPrivileged(action);
        toolkitThread.start();
    }
}
项目:openjdk-jdk7u-jdk    文件:WToolkit.java   
public WToolkit() {
    // Startup toolkit threads
    if (PerformanceLogger.loggingEnabled()) {
        PerformanceLogger.setTime("WToolkit construction");
    }

    sun.java2d.Disposer.addRecord(anchor, new ToolkitDisposer());

    /*
     * Fix for 4701990.
     * AWTAutoShutdown state must be changed before the toolkit thread
     * starts to avoid race condition.
     */
    AWTAutoShutdown.notifyToolkitThreadBusy();

    // Find a root TG and attach Appkit thread to it
    ThreadGroup rootTG = AccessController.doPrivileged(new PrivilegedAction<ThreadGroup>() {
                @Override
                public ThreadGroup run() {
                    return ThreadGroupUtils.getRootThreadGroup();
                }
            });
    if (!startToolkitThread(this, rootTG)) {
        Thread toolkitThread = new Thread(rootTG, this, "AWT-Windows");
        toolkitThread.setDaemon(true);
        toolkitThread.start();
    }

    try {
        synchronized(this) {
            while(!inited) {
                wait();
            }
        }
    } catch (InterruptedException x) {
        // swallow the exception
    }

    SunToolkit.setDataTransfererClassName(DATA_TRANSFERER_CLASS_NAME);

    // Enabled "live resizing" by default.  It remains controlled
    // by the native system though.
    setDynamicLayout(true);

    areExtraMouseButtonsEnabled = Boolean.parseBoolean(System.getProperty("sun.awt.enableExtraMouseButtons", "true"));
    //set system property if not yet assigned
    System.setProperty("sun.awt.enableExtraMouseButtons", ""+areExtraMouseButtonsEnabled);
    setExtraMouseButtonsEnabledNative(areExtraMouseButtonsEnabled);
}
项目:openjdk-jdk7u-jdk    文件:MToolkit.java   
public MToolkit() {
    super();
    if (PerformanceLogger.loggingEnabled()) {
        PerformanceLogger.setTime("MToolkit construction");
    }
    if (!GraphicsEnvironment.isHeadless()) {
        String mainClassName = null;

        StackTraceElement trace[] = (new Throwable()).getStackTrace();
        int bottom = trace.length - 1;
        if (bottom >= 0) {
            mainClassName = trace[bottom].getClassName();
        }
        if (mainClassName == null || mainClassName.equals("")) {
            mainClassName = "AWT";
        }

        init(mainClassName);
        //SunToolkit.setDataTransfererClassName(DATA_TRANSFERER_CLASS_NAME);

        Thread toolkitThread = new Thread(this, "AWT-Motif");
        toolkitThread.setPriority(Thread.NORM_PRIORITY + 1);
        toolkitThread.setDaemon(true);

        PrivilegedAction<Void> a = new PrivilegedAction<Void>() {
            public Void run() {
                ThreadGroup mainTG = Thread.currentThread().getThreadGroup();
                ThreadGroup parentTG = mainTG.getParent();

                while (parentTG != null) {
                    mainTG = parentTG;
                    parentTG = mainTG.getParent();
                }
                Thread shutdownThread = new Thread(mainTG, new Runnable() {
                        public void run() {
                            shutdown();
                        }
                    }, "Shutdown-Thread");
                shutdownThread.setContextClassLoader(null);
                Runtime.getRuntime().addShutdownHook(shutdownThread);
                return null;
            }
        };
        AccessController.doPrivileged(a);

        /*
         * Fix for 4701990.
         * AWTAutoShutdown state must be changed before the toolkit thread
         * starts to avoid race condition.
         */
        AWTAutoShutdown.notifyToolkitThreadBusy();

        toolkitThread.start();
    }
}
项目:openjdk-icedtea7    文件:WToolkit.java   
public WToolkit() {
    // Startup toolkit threads
    if (PerformanceLogger.loggingEnabled()) {
        PerformanceLogger.setTime("WToolkit construction");
    }

    sun.java2d.Disposer.addRecord(anchor, new ToolkitDisposer());

    /*
     * Fix for 4701990.
     * AWTAutoShutdown state must be changed before the toolkit thread
     * starts to avoid race condition.
     */
    AWTAutoShutdown.notifyToolkitThreadBusy();

    if (!startToolkitThread(this)) {
        Thread toolkitThread = new Thread(this, "AWT-Windows");
        toolkitThread.setDaemon(true);
        toolkitThread.start();
    }

    try {
        synchronized(this) {
            while(!inited) {
                wait();
            }
        }
    } catch (InterruptedException x) {
        // swallow the exception
    }

    SunToolkit.setDataTransfererClassName(DATA_TRANSFERER_CLASS_NAME);

    // Enabled "live resizing" by default.  It remains controlled
    // by the native system though.
    setDynamicLayout(true);

    areExtraMouseButtonsEnabled = Boolean.parseBoolean(System.getProperty("sun.awt.enableExtraMouseButtons", "true"));
    //set system property if not yet assigned
    System.setProperty("sun.awt.enableExtraMouseButtons", ""+areExtraMouseButtonsEnabled);
    setExtraMouseButtonsEnabledNative(areExtraMouseButtonsEnabled);
}
项目:openjdk-icedtea7    文件:MToolkit.java   
public MToolkit() {
    super();
    if (PerformanceLogger.loggingEnabled()) {
        PerformanceLogger.setTime("MToolkit construction");
    }
    if (!GraphicsEnvironment.isHeadless()) {
        String mainClassName = null;

        StackTraceElement trace[] = (new Throwable()).getStackTrace();
        int bottom = trace.length - 1;
        if (bottom >= 0) {
            mainClassName = trace[bottom].getClassName();
        }
        if (mainClassName == null || mainClassName.equals("")) {
            mainClassName = "AWT";
        }

        init(mainClassName);
        //SunToolkit.setDataTransfererClassName(DATA_TRANSFERER_CLASS_NAME);

        Thread toolkitThread = new Thread(this, "AWT-Motif");
        toolkitThread.setPriority(Thread.NORM_PRIORITY + 1);
        toolkitThread.setDaemon(true);

        PrivilegedAction<Void> a = new PrivilegedAction<Void>() {
            public Void run() {
                ThreadGroup mainTG = Thread.currentThread().getThreadGroup();
                ThreadGroup parentTG = mainTG.getParent();

                while (parentTG != null) {
                    mainTG = parentTG;
                    parentTG = mainTG.getParent();
                }
                Thread shutdownThread = new Thread(mainTG, new Runnable() {
                        public void run() {
                            shutdown();
                        }
                    }, "Shutdown-Thread");
                shutdownThread.setContextClassLoader(null);
                Runtime.getRuntime().addShutdownHook(shutdownThread);
                return null;
            }
        };
        AccessController.doPrivileged(a);

        /*
         * Fix for 4701990.
         * AWTAutoShutdown state must be changed before the toolkit thread
         * starts to avoid race condition.
         */
        AWTAutoShutdown.notifyToolkitThreadBusy();

        toolkitThread.start();
    }
}
项目:openjdk-icedtea7    文件:XToolkit.java   
public XToolkit() {
    super();
    if (PerformanceLogger.loggingEnabled()) {
        PerformanceLogger.setTime("XToolkit construction");
    }

    if (!GraphicsEnvironment.isHeadless()) {
        String mainClassName = null;

        StackTraceElement trace[] = (new Throwable()).getStackTrace();
        int bottom = trace.length - 1;
        if (bottom >= 0) {
            mainClassName = trace[bottom].getClassName();
        }
        if (mainClassName == null || mainClassName.equals("")) {
            mainClassName = "AWT";
        }
        awtAppClassName = getCorrectXIDString(mainClassName);

        init();
        XWM.init();
        SunToolkit.setDataTransfererClassName(DATA_TRANSFERER_CLASS_NAME);

        PrivilegedAction<Thread> action = new PrivilegedAction() {
            public Thread run() {
                ThreadGroup currentTG = Thread.currentThread().getThreadGroup();
                ThreadGroup parentTG = currentTG.getParent();
                while (parentTG != null) {
                    currentTG = parentTG;
                    parentTG = currentTG.getParent();
                }
                Thread thread = new Thread(currentTG, XToolkit.this, "AWT-XAWT");
                thread.setPriority(Thread.NORM_PRIORITY + 1);
                thread.setDaemon(true);
                return thread;
            }
        };
        toolkitThread = AccessController.doPrivileged(action);
        toolkitThread.start();
    }
}