/** Stops unicast and multicast receiver threads */ void stopThreads() { Thread tmp; // 1. Stop the multicast receiver thread if (mcast_receiver != null) { if (mcast_receiver.isAlive()) { tmp = mcast_receiver; mcast_receiver = null; closeMulticastSocket(); // will cause the multicast thread to terminate tmp.interrupt(); try { tmp.join(100); } catch (Exception e) { } tmp = null; } mcast_receiver = null; } // 2. Stop the unicast receiver thread if (ucast_receiver != null) { ucast_receiver.stop(); ucast_receiver = null; } // 3. Stop the in_packet_handler thread if (incoming_packet_handler != null) { incoming_packet_handler.stop(); } }
public void stop() { Thread tmp; if (thread != null && thread.isAlive()) { running = false; tmp = thread; thread = null; closeSocket(); // this will cause the thread to break out of its loop tmp.interrupt(); tmp = null; } thread = null; }
protected void stopFlusher() { flushing = false; Thread tmp = flusher; while (tmp != null && tmp.isAlive()) { tmp.interrupt(); ack_promise.setResult(null); try { tmp.join(); } catch (InterruptedException e) { } } }
public synchronized void stop() { Thread tmp = thread; if (thread != null && thread.isAlive()) tmp.interrupt(); thread = null; }