/// <summary> /// 初始化 /// </summary> public static void Initialize() { RpcEnvironment.CurrentFlow = RpcFlowType.GlobalInitializing; GlobalsFuturesOption.ReigsterEntityType(); RpcCore.Run(); RpcEnvironment.CurrentFlow = RpcFlowType.GlobalInitialized; }
/// <summary> /// 启动 /// </summary> public static void Run() { if (Singleton != null) { ShutDown(); } Singleton = new RpcCore(); Singleton.init_net_command(); Singleton.start_net_command(); }
/// <summary> /// 执行销毁时 /// </summary> public static void Destroy() { RpcEnvironment.CurrentFlow = RpcFlowType.Exiting; var cnt = 0; while (RpcEnvironment.CurrentFlow == RpcFlowType.Exiting && cnt++ < 30) { Thread.Sleep(100); } RpcCore.ShutDown(); RpcEnvironment.ClearCacheCommand(); RpcEnvironment.CurrentFlow = RpcFlowType.Destroied; }