/// <summary>
        ///     释放资源
        /// </summary>
        public void Dispose()
        {
            if (Interlocked.Increment(ref isDisposed) == 1)
            {
                save();
                forwardHost = null;

                TmphPub.Dispose(ref fileWatcher);

                Monitor.Enter(domainLock);
                var domains = this.domains;
                this.domains = TmphDomainSearcher.Default;
                Monitor.Exit(domainLock);
                domains.Close();
                domains.Dispose();

                TmphServer[] servers = null;
                Monitor.Enter(hostLock);
                try
                {
                    servers = hosts.Values.GetArray();
                    hosts = null;
                }
                finally
                {
                    Monitor.Exit(hostLock);
                    if (servers != null) foreach (var server in servers) server.Dispose();
                }
            }
        }