Good tips, JZ

Just got the latest "Core Java Technologies" Technical Tips email, and in it are two interesting little tidbits:

    Three Swing "Urban Legends":
        "Create threads for long tasks from the event dispatch thread." Problem is, as it turns out, the event thread runs at a higher priority than normal, so threads spun from the event thread also run at a higher priority level. Set them back to NORM_PRIORITY before starting them.
        "Use SwingUtilities for running tasks on the event dispatch thread." Turns out that SwingUtilities is just a wrapper around EventQueue, so just use those methods directly.
        "Synchronize methods for synchronization." Turns out that synchronizing on the method is dangerous for AWT Components, so prefer to use an internal lock object instead.
    From Runtime.exec() to ProcessBuilder: Stop using Runtime.exec() (which was always problematic anyway), and start using ProcessBuilder instead, which gives you more control over the launch, environment, and reading/writing to the stdout/stderr/stdin streams anyway.

It’s been a long time since I saw tidbits in here that weren’t rehashes of existing documentation, so kudos to John Zukowski, the author of the Tips!