public void start() { if (receiver != null) receiver.stop(); receiver = new Receiver(server.factory).start(); if (isSenderUsed()) { if (sender != null) sender.stop(); sender = new Sender(server.factory, server.sendQueueSize()).start(); } }
public void close() throws IOException { send_lock.lock(); try { Util.close(out, in, sock); if (receiver != null) { receiver.stop(); receiver = null; } if (sender != null) { sender.stop(); sender = null; } } finally { send_lock.unlock(); } }