/** Permanently shuts down all related resources. */ @Override public void close() throws IOException { // clear flag _enabled = false; // release timers for (TimerTask timer : _timers) timer.cancel(); Stream.safeClose(_sendSocket, _receiveSocket, _hardLinksSocket); }
/** Permanently shuts down this managed TCP connection. */ @Override public void close() { synchronized (_lock) { if (_shutdown) return; _shutdown = true; _outputStream = null; if (_startTimer != null) _startTimer.cancel(); Stream.safeClose(_socket); _socket = null; // notify the connection and receive thread if it happens to be waiting _lock.notify(); } }