sun.awt.AWTAutoShutdown Java Examples
The following examples show how to use
sun.awt.AWTAutoShutdown.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EventQueue.java From jdk-1.7-annotated with Apache License 2.0 | 6 votes |
final void initDispatchThread() { pushPopLock.lock(); try { if (dispatchThread == null && !threadGroup.isDestroyed() && !appContext.isDisposed()) { dispatchThread = AccessController.doPrivileged( new PrivilegedAction<EventDispatchThread>() { public EventDispatchThread run() { EventDispatchThread t = new EventDispatchThread(threadGroup, name, EventQueue.this); t.setContextClassLoader(classLoader); t.setPriority(Thread.NORM_PRIORITY + 1); t.setDaemon(false); AWTAutoShutdown.getInstance().notifyThreadBusy(t); return t; } } ); dispatchThread.start(); } } finally { pushPopLock.unlock(); } }
Example #2
Source File: EventQueue.java From jdk-1.7-annotated with Apache License 2.0 | 6 votes |
/** * Called from dispatchEvent() under a correct AccessControlContext */ private void dispatchEventImpl(final AWTEvent event, final Object src) { event.isPosted = true; if (event instanceof ActiveEvent) { // This could become the sole method of dispatching in time. setCurrentEventAndMostRecentTimeImpl(event); ((ActiveEvent)event).dispatch(); } else if (src instanceof Component) { ((Component)src).dispatchEvent(event); event.dispatched(); } else if (src instanceof MenuComponent) { ((MenuComponent)src).dispatchEvent(event); } else if (src instanceof TrayIcon) { ((TrayIcon)src).dispatchEvent(event); } else if (src instanceof AWTAutoShutdown) { if (noEvents()) { dispatchThread.stopDispatching(); } } else { if (eventLog.isLoggable(PlatformLogger.FINE)) { eventLog.fine("Unable to dispatch event: " + event); } } }
Example #3
Source File: EventQueue.java From jdk-1.7-annotated with Apache License 2.0 | 6 votes |
/** * Removes an event from the <code>EventQueue</code> and * returns it. This method will block until an event has * been posted by another thread. * @return the next <code>AWTEvent</code> * @exception InterruptedException * if any thread has interrupted this thread */ public AWTEvent getNextEvent() throws InterruptedException { do { /* * SunToolkit.flushPendingEvents must be called outside * of the synchronized block to avoid deadlock when * event queues are nested with push()/pop(). */ SunToolkit.flushPendingEvents(appContext); pushPopLock.lock(); try { AWTEvent event = getNextEventPrivate(); if (event != null) { return event; } AWTAutoShutdown.getInstance().notifyThreadFree(dispatchThread); pushPopCond.await(); } finally { pushPopLock.unlock(); } } while(true); }
Example #4
Source File: EventQueue.java From jdk-1.7-annotated with Apache License 2.0 | 6 votes |
/** * Posts a 1.1-style event to the <code>EventQueue</code>. * If there is an existing event on the queue with the same ID * and event source, the source <code>Component</code>'s * <code>coalesceEvents</code> method will be called. * * @param theEvent an instance of <code>java.awt.AWTEvent</code>, * or a subclass of it */ private final void postEventPrivate(AWTEvent theEvent) { theEvent.isPosted = true; pushPopLock.lock(); try { if (nextQueue != null) { // Forward the event to the top of EventQueue stack nextQueue.postEventPrivate(theEvent); return; } if (dispatchThread == null) { if (theEvent.getSource() == AWTAutoShutdown.getInstance()) { return; } else { initDispatchThread(); } } postEvent(theEvent, getPriority(theEvent)); } finally { pushPopLock.unlock(); } }
Example #5
Source File: EventQueue.java From jdk-1.7-annotated with Apache License 2.0 | 5 votes |
final boolean detachDispatchThread(EventDispatchThread edt, boolean forceDetach) { /* * This synchronized block is to secure that the event dispatch * thread won't die in the middle of posting a new event to the * associated event queue. It is important because we notify * that the event dispatch thread is busy after posting a new event * to its queue, so the EventQueue.dispatchThread reference must * be valid at that point. */ pushPopLock.lock(); try { if (edt == dispatchThread) { /* * Don't detach the thread if any events are pending. Not * sure if it's a possible scenario, though. * * Fix for 4648733. Check both the associated java event * queue and the PostEventQueue. */ if (!forceDetach && (peekEvent() != null) || !SunToolkit.isPostEventQueueEmpty()) { return false; } dispatchThread = null; } AWTAutoShutdown.getInstance().notifyThreadFree(edt); return true; } finally { pushPopLock.unlock(); } }
Example #6
Source File: EventQueue.java From jdk-1.7-annotated with Apache License 2.0 | 5 votes |
/** * Posts the event to the internal Queue of specified priority, * coalescing as appropriate. * * @param theEvent an instance of <code>java.awt.AWTEvent</code>, * or a subclass of it * @param priority the desired priority of the event */ private void postEvent(AWTEvent theEvent, int priority) { if (coalesceEvent(theEvent, priority)) { return; } EventQueueItem newItem = new EventQueueItem(theEvent); cacheEQItem(newItem); boolean notifyID = (theEvent.getID() == this.waitForID); if (queues[priority].head == null) { boolean shouldNotify = noEvents(); queues[priority].head = queues[priority].tail = newItem; if (shouldNotify) { if (theEvent.getSource() != AWTAutoShutdown.getInstance()) { AWTAutoShutdown.getInstance().notifyThreadBusy(dispatchThread); } pushPopCond.signalAll(); } else if (notifyID) { pushPopCond.signalAll(); } } else { // The event was not coalesced or has non-Component source. // Insert it at the end of the appropriate Queue. queues[priority].tail.next = newItem; queues[priority].tail = newItem; if (notifyID) { pushPopCond.signalAll(); } } }
Example #7
Source File: WToolkit.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
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); }
Example #8
Source File: DesktopApplicationImpl.java From consulo with Apache License 2.0 | 4 votes |
public DesktopApplicationImpl(boolean isHeadless, @Nonnull Ref<? extends StartupProgress> splashRef) { super(splashRef); ApplicationManager.setApplication(this); AWTExceptionHandler.register(); // do not crash AWT on exceptions myIsInternal = ApplicationProperties.isInternal(); String debugDisposer = System.getProperty("idea.disposer.debug"); consulo.disposer.Disposer.setDebugMode((myIsInternal || "on".equals(debugDisposer)) && !"off".equals(debugDisposer)); myHeadlessMode = isHeadless; myDoNotSave = isHeadless; myGatherStatistics = LOG.isDebugEnabled() || isInternal(); if (!isHeadless) { consulo.disposer.Disposer.register(this, Disposable.newDisposable(), "ui"); StartupUtil.addExternalInstanceListener(commandLineArgs -> { LOG.info("ApplicationImpl.externalInstanceListener invocation"); CommandLineProcessor.processExternalCommandLine(commandLineArgs, null).doWhenDone(project -> { final IdeFrame frame = WindowManager.getInstance().getIdeFrame(project); if (frame != null) AppIcon.getInstance().requestFocus(frame); }); }); WindowsCommandLineProcessor.LISTENER = (currentDirectory, commandLine) -> { LOG.info("Received external Windows command line: current directory " + currentDirectory + ", command line " + commandLine); invokeLater(() -> { final List<String> args = StringUtil.splitHonorQuotes(commandLine, ' '); args.remove(0); // process name CommandLineProcessor.processExternalCommandLine(CommandLineArgs.parse(ArrayUtil.toStringArray(args)), currentDirectory); }); }; } Thread edt = UIUtil.invokeAndWaitIfNeeded(() -> { // instantiate AppDelayQueue which starts "Periodic task thread" which we'll mark busy to prevent this EDT to die // that thread was chosen because we know for sure it's running AppScheduledExecutorService service = (AppScheduledExecutorService)AppExecutorUtil.getAppScheduledExecutorService(); Thread thread = service.getPeriodicTasksThread(); AWTAutoShutdown.getInstance().notifyThreadBusy(thread); // needed for EDT not to exit suddenly consulo.disposer.Disposer.register(this, () -> { AWTAutoShutdown.getInstance().notifyThreadFree(thread); // allow for EDT to exit - needed for Upsource }); return Thread.currentThread(); }); NoSwingUnderWriteAction.watchForEvents(this); }
Example #9
Source File: WToolkit.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
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); }
Example #10
Source File: WToolkit.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
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); }
Example #11
Source File: WToolkit.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
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); }
Example #12
Source File: WToolkit.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
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); }
Example #13
Source File: WToolkit.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
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); }
Example #14
Source File: WToolkit.java From hottub with GNU General Public License v2.0 | 4 votes |
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); }
Example #15
Source File: WToolkit.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
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); }
Example #16
Source File: WToolkit.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
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 toolkit thread to it ThreadGroup rootTG = AccessController.doPrivileged( (PrivilegedAction<ThreadGroup>) ThreadGroupUtils::getRootThreadGroup); if (!startToolkitThread(this, rootTG)) { String name = "AWT-Windows"; Thread toolkitThread = new Thread(rootTG, this, name, 0, false); 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); }
Example #17
Source File: WToolkit.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
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); }
Example #18
Source File: WToolkit.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
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); }
Example #19
Source File: WToolkit.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
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); }
Example #20
Source File: WToolkit.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
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); }