/// <summary> /// Stop this Orleans silo executing. /// </summary> public void Stop() { logger.Info(ErrorCode.Runtime_Error_100290, "Stopping {0}", this.GetType().FullName); RoleEnvironment.Stopping -= HandleAzureRoleStopping; host.ShutdownOrleansSilo(); logger.Info(ErrorCode.Runtime_Error_100291, "Orleans silo '{0}' shutdown.", host.Name); }
/// <summary> /// Stop this Orleans silo executing. /// </summary> public void Stop() { logger.Info(ErrorCode.Runtime_Error_100290, "Stopping {0}", this.GetType().FullName); serviceRuntimeWrapper.UnsubscribeFromStoppingNotification(this, HandleAzureRoleStopping); host.ShutdownOrleansSilo(); logger.Info(ErrorCode.Runtime_Error_100291, "Orleans silo '{0}' shutdown.", host.Name); }
static void Main(string[] args) { var config = new Orleans.Runtime.Configuration.ClusterConfiguration(); config.LoadFromFile("Host.xml"); //SiloHost siloHost = new SiloHost(System.Net.Dns.GetHostName()); //初始化一个silohost,这里使用了Orleans提供的silohost而不是silo,其中silo的名字命名为Ba; Orleans.Runtime.Host.SiloHost siloHost = new Orleans.Runtime.Host.SiloHost("Ba", config); //初始化仓储 siloHost.InitializeOrleansSilo(); //启动 siloHost.StartOrleansSilo(); //检查一下 if (siloHost.IsStarted) { Console.WriteLine("silohost 启动成功"); } else { Console.WriteLine("启动失败"); } Console.ReadKey(); //关闭silo siloHost.StopOrleansSilo(); //未初始化这个silo (搞不懂啥意思) siloHost.UnInitializeOrleansSilo(); //优雅的关闭这个silo siloHost.ShutdownOrleansSilo(); Console.ReadKey(); }