JavaFX - dans l'attente de la tâche à terminer

J'ai un JavaFX application qui instancie plusieurs Tâche objets.

Actuellement, ma mise en œuvre (voir ci-dessous) appelle le comportement runFactory() qui effectue le calcul en vertu d'un objet Tâche. Parallèlement à cela, nextFunction() est invoquée. Est-il un moyen d'avoir nextFunction() "attendre" jusqu'à ce que l'état de la Tâche est terminée?

Je comprends fil.join() attend jusqu'à ce que le thread en cours d'exécution est terminée, mais avec des Interfaces graphiques, il y a de nouveaux niveaux de complexité en raison de l'event dispatch thread.
Comme une question de fait, l'ajout de fil.join() à la fin du code du segment ci-dessous, ne cesse de l'INTERFACE utilisateur de l'interaction.

Si il y a des suggestions à faire nextFunction attendre jusqu'à ce que sa fonction antérieure, runFactory est terminé, je serais très reconnaissante.

Merci,

//High-level class to run the Knuth-Morris-Pratt algorithm.
public class AlignmentFactory {
    public void perform() {
        KnuthMorrisPrattFactory factory = new KnuthMorrisPrattFactory();
        factory.runFactory();   //nextFunction invoked w/out runFactory finishing.
        //Code to run once runFactory() is complete.
        nextFunction()   //also invokes a Task.
        ...
    }
}

//Implementation of Knuth-Morris-Pratt given a list of words and a sub-string.
public class KnuthMorrisPratt {
   public void runFactory() throws InterruptedException {
       Thread thread = null;
       Task<Void> task = new Task<Void>() {

           @Override public Void call() throws InterruptedException {
           for (InputSequence seq: getSequences) {
                KnuthMorrisPratt kmp = new KnuthMorrisPratt(seq, substring);
                kmp.align();

            }
            return null; 
        }
    };
    thread = new Thread(task);
    thread.setDaemon(true);
    thread.start();
}

OriginalL'auteur mtor.signaling | 2013-03-05