Bonjour,
Pb : je ne passe jamais dans le bloc "catch(InterruptedException)".
Info : toutes les méthodes sous-jacentes à run() ne traitent pas cette interruption mais la renvoie.
Question : Pourquoi l'interruption n'est pas attrapée dans ma méthode run() ?
Merci d'avance
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46 public class BalayageDlg extends JDialog implements Runnable { . . private void initialize() { . . this.addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent e) { if(con!=null) { //fermer la connexion et rendre le port com if(comThread!=null && comThread.isAlive()) { //ordre d'interruption, doit être attrapé par le thread comThread.interrupt(); //fermeture de la connexion et des listeners con.setOpened(false); } } } }); } public void run() { comThread = Thread.currentThread(); try { if (this.isHF) balayageHf(); else balayageFilaire(); } catch(InterruptedException iex) { Thread.currentThread().interrupt(); } parent.getBT_DetecterParc().setText(Hemolog.RES.getString("Detecter")+"("+parent.getNbActif()+")"); close(); } . . }
Partager