protected void closeLine(boolean willReopen) { CaptureThread oldThread = null; synchronized (this) { if (!willReopen && thread != null) { thread.terminate(); } super.closeLine(willReopen); if (!willReopen) { if (ais != null) { if (VERBOSE) out("AudioCapture.closeLine(): closing input stream"); try { ais.close(); } catch (IOException ignored) { } } if (thread != null) { if (outputStream != null) { try { outputStream.close(); } catch (IOException ignored) { } outputStream = null; } oldThread = thread; } } } if (oldThread != null) { if (VERBOSE) out("AudioCapture.closeLine(): closing thread, waiting for it to die"); oldThread.waitFor(); if (VERBOSE) out("AudioCapture.closeLine(): thread closed"); } }