code: private static void destroy(boolean active) {
          // TODO 检查是否有其它需要释放的资源
          RpcRunningState.setShuttingDown(true);
          for (Destroyable.DestroyHook destroyHook : DESTROY_HOOKS) {
              destroyHook.preDestroy();
          }
          List<ProviderConfig> providerConfigs = new ArrayList<ProviderConfig>();
          for (ProviderBootstrap bootstrap : EXPORTED_PROVIDER_CONFIGS) {
              providerConfigs.add(bootstrap.getProviderConfig());
          }
          // 先反注册服务端
          List<Registry> registries = RegistryFactory.getRegistries();
          if (CommonUtils.isNotEmpty(registries) && CommonUtils.isNotEmpty(providerConfigs)) {
              for (Registry registry : registries) {
                  registry.batchUnRegister(providerConfigs);
              }
          }
          // 关闭启动的端口
          ServerFactory.destroyAll();
          // 关闭发布的服务
          for (ProviderBootstrap bootstrap : EXPORTED_PROVIDER_CONFIGS) {
              bootstrap.unExport();
          }
          // 关闭调用的服务
          for (ConsumerBootstrap bootstrap : REFERRED_CONSUMER_CONFIGS) {
              ConsumerConfig config = bootstrap.getConsumerConfig();
              if (!CommonUtils.isFalse(config.getParameter(RpcConstants.HIDDEN_KEY_DESTROY))) { // 除非不让主动unrefer
                  bootstrap.unRefer();
              }
          }
          // 关闭注册中心
          RegistryFactory.destroyAll();
          // 关闭客户端的一些公共资源
          ClientTransportFactory.closeAll();
          // 卸载模块
          if (!RpcRunningState.isUnitTestMode()) {
              ModuleFactory.uninstallModules();
          }
          // 卸载钩子
          for (Destroyable.DestroyHook destroyHook : DESTROY_HOOKS) {
              destroyHook.postDestroy();
          }
          // 清理缓存
          RpcCacheManager.clearAll();
          RpcRunningState.setShuttingDown(false);
          if (LOGGER.isWarnEnabled()) {
              LOGGER.warn("SOFA RPC Framework has been release all resources {}...",
                  active ? "actively " : "");
          }
      }
docs: 销毁方法
  
  @param active 是否主动销毁