X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=altoslib%2FAltosIdleMonitor.java;h=c816c202cc44533463a7763fb943fe9219e938fe;hp=d858845a1af0dbe0ea10837191cfa053507439d7;hb=e26306c9350ef1d107d4257ef1c09d15165c9154;hpb=18852efa108ba6e6e69dfd5076d4f4c01f62b4ef 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)