¿Por qué SwingWorker se detiene inesperadamente?

Quería probar algunas ideas usandoSwingWorker ya que no lo he usado demasiado. En su lugar, me encontré con un problema y no puedo entender qué está mal.

Aquí hay un breveSSCCE Eso demuestra este problema (conozco a personas aquí como SSCCE):

import javax.swing.SwingUtilities;
import javax.swing.SwingWorker;

public class SwingWorkerTest
{
    public static void main (String[] args)
    {
        SwingUtilities.invokeLater (new Runnable ()
        {
            @Override
            public void run ()
            {
                new MySwingWorker (500).execute ();
                new MySwingWorker (900).execute ();
                new MySwingWorker (1200).execute ();
            }
        });
    }
}

class MySwingWorker extends SwingWorker<Void, Void>
{
    private int ms;

    public MySwingWorker (int ms)
    {
        this.ms = ms;
    }

    @Override
    protected Void doInBackground()
    {
        Thread t = Thread.currentThread ();

        for (int i = 0; i < 50; i++)
        {
            try
            {
                Thread.sleep (ms);
            }
            catch (InterruptedException e)
            {
                e.printStackTrace ();
            }

            System.out.println ("I am thread with " + ms + " sleep in iteration " + i + ": " + t.getName () + " (" + t.getId () + ")");
        }

        return null;
    }
}

Así que mi programa debería crear 3 SwingWorkers que imprimen una línea en la pantalla, luego duermen durante la cantidad especificada de milisegundos y luego vuelven a imprimir la línea y vuelven a dormir otra vez, etc.SwingWorkers desde dentro del hilo de Swing porque de lo contrario ni siquiera se iniciarían.

Así que la salida esperada es:

I am thread with 500 sleep in iteration 0: SwingWorker-pool-1-thread-1 (15)
I am thread with 900 sleep in iteration 0: SwingWorker-pool-1-thread-2 (16)
I am thread with 500 sleep in iteration 1: SwingWorker-pool-1-thread-1 (15)
I am thread with 1200 sleep in iteration 0: SwingWorker-pool-1-thread-3 (17)
I am thread with 500 sleep in iteration 2: SwingWorker-pool-1-thread-1 (15)
I am thread with 900 sleep in iteration 1: SwingWorker-pool-1-thread-2 (16)
I am thread with 500 sleep in iteration 3: SwingWorker-pool-1-thread-1 (15)
I am thread with 1200 sleep in iteration 1: SwingWorker-pool-1-thread-3 (17)
I am thread with 500 sleep in iteration 4: SwingWorker-pool-1-thread-1 (15)
I am thread with 900 sleep in iteration 2: SwingWorker-pool-1-thread-2 (16)
I am thread with 500 sleep in iteration 5: SwingWorker-pool-1-thread-1 (15)
I am thread with 500 sleep in iteration 6: SwingWorker-pool-1-thread-1 (15)
I am thread with 900 sleep in iteration 3: SwingWorker-pool-1-thread-2 (16)
I am thread with 1200 sleep in iteration 2: SwingWorker-pool-1-thread-3 (17)
I am thread with 500 sleep in iteration 7: SwingWorker-pool-1-thread-1 (15)
.............

y así sucesivamente para un total de 150 líneas (3 trabajadores x 50 iteraciones para cada uno)

En cambio, la salida que obtengo es:

I am thread with 500 sleep in iteration 0: SwingWorker-pool-1-thread-1 (15)
I am thread with 900 sleep in iteration 0: SwingWorker-pool-1-thread-2 (16)
I am thread with 500 sleep in iteration 1: SwingWorker-pool-1-thread-1 (15)

Y eso es. Sólo 3 líneas. Después de esto el programa sale. No hay apilamiento en ninguna parte de esotry catch bloquear.

1). ¿Dónde está el trabajador con los 1200ms de sueño? En realidad, si reemplazo 1200 ms por 1000 ms, este trabajador también imprime 1 línea ... sí, solo una. Extraño...

2). ¿Por qué los trabajadores se detienen? (y no consigo 150 líneas de cosas)

Corrí este programa usandoJRE 7 Update 11 en Windows 7 de 64 bits.

PD: estoy bastante seguro de queel error mencionado aquí Se corrigió en esta versión de JRE, ya que obtengo 2 valores distintos (15 y 16) como ID de hilo impresos en la consola. Esto fue lo primero que sospeché.

Respuestas a la pregunta(4)

Su respuesta a la pregunta