public synchronized void shutdown() throws SyslogRuntimeException {
		if (this.socket == null) {
			return;
		}

		if (this.syslogConfig.isThreaded()) {
			this.shutdown = true;

			final long timeStart = System.currentTimeMillis();
			boolean done = false;

			while(!done) {
				if (this.socket == null || this.socket.isClosed()) {
					done = true;

				} else {
					final long now = System.currentTimeMillis();

					if (now > (timeStart + this.tcpNetSyslogConfig.getMaxShutdownWait())) {
						closeSocket(this.socket);
						this.thread.interrupt();
						done = true;
					}

					if (!done) {
						try {
							Thread.sleep(SyslogConstants.SHUTDOWN_INTERVAL);
						} catch (final InterruptedException ie) {
							//
						}
					}
				}
			}

		} else {
			closeSocket(this.socket);
		}
	}