Ejemplo n.º 1
0
 /// <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.StopOrleansSilo();
     logger.Info(ErrorCode.Runtime_Error_100291, "Orleans silo '{0}' shutdown.", host.Name);
 }
Ejemplo n.º 2
0
        private static void Main()
        {
            while (true)
            {
                Console.WriteLine("请输入配置文件名称:");
                var configName = Console.ReadLine();
                var configFile = new FileInfo(Path.Combine(AppDomain.CurrentDomain.BaseDirectory,
                    $"{Path.GetFileNameWithoutExtension(configName)}.xml"));
                if (!configFile.Exists)
                {
                    Console.WriteLine($"配置文件:{configFile.FullName},不存在!");
                    continue;
                }
                Console.WriteLine("请输入节点名称:");
                var nodeName = Console.ReadLine() ?? string.Empty;
                using (var host = new SiloHost(nodeName, configFile))
                {
                    host.LoadOrleansConfig();
                    host.InitializeOrleansSilo();
                    host.StartOrleansSilo();

                    Console.WriteLine("已启动,按下任意键退出。");
                    Console.ReadLine();

                    host.StopOrleansSilo();
                }
                break;
            }
        }
Ejemplo n.º 3
0
        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();
        }
Ejemplo n.º 4
0
        private static void Main(string[] args){
            using (SiloHost host = new SiloHost("Default")){
                host.LoadOrleansConfig();
                host.InitializeOrleansSilo();
                host.StartOrleansSilo();

                Console.WriteLine("Start--------");
                Console.ReadLine();

                host.StopOrleansSilo();
            }
        }
Ejemplo n.º 5
0
        public bool Stop()
        {
            bool ok = false;

            try
            {
                siloHost.StopOrleansSilo();

                Console.WriteLine(string.Format("Orleans silo '{0}' shutdown.", siloHost.Name));
            }
            catch (Exception exc)
            {
                siloHost.ReportStartupError(exc);
                var msg = string.Format("{0}:\n{1}\n{2}", exc.GetType().FullName, exc.Message, exc.StackTrace);
                Console.WriteLine(msg);
            }

            return(ok);
        }
Ejemplo n.º 6
0
        static void Main(string[] args)
        {
            while (true)
            {
                Console.WriteLine("请输入配置文件名称:");
                var configName = Console.ReadLine();
                configName = string.IsNullOrEmpty(configName) ? "OrleansConfiguration" : configName;
                var configFile = new FileInfo(
                    Path.Combine(AppDomain.CurrentDomain.BaseDirectory,
                    string.Format("{0}.xml", configName)));
                if (!configFile.Exists)
                {
                    Console.WriteLine("配置文件:{0} 不存在", configFile.Name);
                    continue;
                }
                Console.WriteLine("请输入节点名称");
                var nodeName = Console.ReadLine() ?? string.Empty;

                using (var host = new SiloHost(nodeName, configFile))
                {
                    host.LoadOrleansConfig();
                    host.InitializeOrleansSilo();
                    host.StartOrleansSilo();

                    Console.WriteLine("已启动,按下任意键退出");
                    Console.ReadLine();
                    host.StopOrleansSilo();
                }
            }
           
            //AppDomain hostDomain=AppDomain.CreateDomain("OrleansHost",null,new AppDomainSetup()
            //{
            //    AppDomainInitializer =InitSilo
            //});

            //DoSomeClientWork();
            //Console.WriteLine("Orleans Silo is running.\nPress Enter to terminate...");
            //Console.ReadLine();

            //hostDomain.DoCallBack(ShutdownSilo);
        }