X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=altoslib%2FAltosIdleMonitor.java;h=c816c202cc44533463a7763fb943fe9219e938fe;hb=dbcf3264f950c4e1d450828c9f161b4c418bee97;hp=d858845a1af0dbe0ea10837191cfa053507439d7;hpb=5b976a6651f4eb05d30afc08b9e1f27c7e52ae00;p=fw%2Faltos diff --git a/altoslib/AltosIdleMonitor.java b/altoslib/AltosIdleMonitor.java index d858845a..c816c202 100644 --- a/altoslib/AltosIdleMonitor.java +++ b/altoslib/AltosIdleMonitor.java @@ -90,15 +90,16 @@ public class AltosIdleMonitor extends Thread { link.abort_reply(); } - public void abort() { - if (isAlive()) { + public void abort() throws InterruptedException { + System.out.printf("Attempting to abort monitor thread\n"); + while (isAlive()) { + System.out.printf("Interrupting\n"); interrupt(); link.abort_reply(); - try { - join(); - } catch (InterruptedException ie) { - } + Thread.sleep(100); } + System.out.printf("Appears to be dead now\n"); + join(); } public void run() { @@ -115,7 +116,10 @@ public class AltosIdleMonitor extends Thread { } } catch (InterruptedException ie) { } - link.close(); + try { + link.close(); + } catch (InterruptedException ie) { + } } public AltosIdleMonitor(AltosIdleMonitorListener in_listener, AltosLink in_link, boolean in_remote)