java.lang.Object
java.lang.Throwable
java.lang.Exception
org.fudaa.fudaa.refonde.RefondeTacheInterruptionException
- All Implemented Interfaces:
- java.io.Serializable
- public class RefondeTacheInterruptionException
- extends java.lang.Exception
Cette exception sert à notifier un arret demandé sur la tache en cours.
Elle est lancée par la méthode RefondeTacheOperation.notifieArretDemande()
si :
- Le thread courant est de type RefondeTacheOperation.
- Un arret a été demandé sur le thread courant par une autre tache
(méthode RefondeTacheOperation.stopWhenReady()).
La méthode RefondeTacheOperation.notifieArretDemande() doit être appelée
suffisamment souvent dans les methodes ou on veut controler
l'interruption de la tache courante pour pouvoir lancer l'exception,
en particulier à l'interieur d'une boucle longue.
Exemple d'utilisation :
RefondeTacheOperation th=new RefondeTacheOperation(this,"Test",true) {
public void act() {
try {
while (true) {
RefondeTacheOperation.notifieArretDemande(); // Lancement de l'exception si l'arret a été demandé.
System.out.println("Continue la boucle");
}
}
catch (RefondeTacheInterruptionException _exc) {
System.out.println("La tache courante a été interrompue");
}
}
};
th.start();
wait(1000);
th.stopWhenReady();
- Version:
- $Id: RefondeTacheInterruptionException.java,v 1.1 2001/11/28 09:43:03 marchand Exp $
| Nested classes inherited from class java.lang.Throwable |
|
| Fields inherited from class java.lang.Exception |
|
| Fields inherited from class java.lang.Throwable |
|
| Methods inherited from class java.lang.Throwable |
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString |
RefondeTacheInterruptionException
public RefondeTacheInterruptionException()
- Création d'une exception sans message.
RefondeTacheInterruptionException
public RefondeTacheInterruptionException(java.lang.String s)
- Création d'une exception avec un message.