java.awt.SecondaryLoop Java Examples

The following examples show how to use java.awt.SecondaryLoop. 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: NbLifecycleManager.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private boolean blockForExit(CountDownLatch[] arr) {
    synchronized (NbLifecycleManager.class) {
        if (onExit != null) {
            arr[0] = onExit;
            LOG.log(Level.FINE, "blockForExit, already counting down {0}", onExit);
            return true;
        }
        arr[0] = onExit = new CountDownLatch(1) {
            @Override
            public void countDown() {
                super.countDown();
                SecondaryLoop d = sndLoop;
                LOG.log(Level.FINE, "countDown for {0}, hiding {1}, by {2}",
                    new Object[] { this, d, Thread.currentThread() }
                );
                if (d != null) {
                    while (!d.exit()) {
                        LOG.log(Level.FINE, "exit before enter, try again");
                    }
                }
            }
        };
        LOG.log(Level.FINE, "blockForExit, new {0}", onExit);
        return false;
    }
}
 
Example #2
Source File: SwingUtil.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * Run any events currently in the event queue
 */
public static void pumpPendingEvents()
{
	EventQueue eq = Toolkit.getDefaultToolkit().getSystemEventQueue();

	if (eq.peekEvent() != null)
	{
		SecondaryLoop l = eq.createSecondaryLoop();
		SwingUtilities.invokeLater(l::exit);
		l.enter();
	}
}