Ingo implemented a facility to adjust the priority of the AWT EventDispatchThread. The priority can now be adjusted using the system property gnu.awt.dispatchthread.priority, and defaults to the old value NORM_PRIORITY+1.
2006-05-10 Roman Kennke <[EMAIL PROTECTED]> Reported by Ingo Proetel ([EMAIL PROTECTED]) * java/awt/EventDispatchThread.java (DEFAULT_PRIORITY): New constant field. (EventDispatchThread()): Added gnu.awt.dispatchthread.priority system property for adjusting the priority of the event dispatch thread. /Roman
Index: java/awt/EventDispatchThread.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/awt/EventDispatchThread.java,v retrieving revision 1.9 diff -u -1 -0 -r1.9 EventDispatchThread.java --- java/awt/EventDispatchThread.java 2 Jul 2005 20:32:24 -0000 1.9 +++ java/awt/EventDispatchThread.java 10 May 2006 10:13:34 -0000 @@ -36,30 +36,50 @@ exception statement from your version. */ package java.awt; /** * @author Bryce McKinlay * @status believed complete, but untested. */ class EventDispatchThread extends Thread { + /** + * The default priority when no property has been set. + */ + private static final int DEFAULT_PRIORITY = NORM_PRIORITY + 1; + private static int dispatchThreadNum; private EventQueue queue; EventDispatchThread(EventQueue queue) { super(); setName("AWT-EventQueue-" + ++dispatchThreadNum); this.queue = queue; - setPriority(NORM_PRIORITY + 1); + + int priority = DEFAULT_PRIORITY; + try + { + String priorityString = + System.getProperty("gnu.awt.dispatchthread.priority"); + if (priorityString != null) + { + priority = Integer.parseInt(priorityString); + } + } + catch (NumberFormatException ex) + { + // Ignore and use default. + } + setPriority(priority); } public void run() { while (true) { try { AWTEvent evt = queue.getNextEvent();