public int Run()
        {
            if (siloHost == null)
            {
                SiloArgs.PrintUsage();
                return(1);
            }

            try
            {
                siloHost.InitializeOrleansSilo();

                if (siloHost.StartOrleansSilo())
                {
                    Console.WriteLine($"Successfully started Orleans silo '{siloHost.Name}' as a {siloHost.Type} node.");
                    return(0);
                }
                else
                {
                    throw new OrleansException($"Failed to start Orleans silo '{siloHost.Name}' as a {siloHost.Type} node.");
                }
            }
            catch (Exception exc)
            {
                siloHost.ReportStartupError(exc);
                Console.Error.WriteLine(exc);
                return(1);
            }
        }
 public int Run()
 {
     if (siloHost == null)
     {
         SiloArgs.PrintUsage();
         return(1);
     }
     try
     {
         siloHost.InitializeOrleansSilo();
         if (siloHost.StartOrleansSilo())
         {
             Console.WriteLine($"Orleans solo 启动成功 '{siloHost.Name}' 作为一个 {siloHost.Type} 节点.");
             return(0);
         }
         else
         {
             throw new OrleansException($"Orleans solo 启动失败 '{siloHost.Name}' 作为一个 {siloHost.Type} 节点.");
         }
     }
     catch (Exception ex)
     {
         siloHost.ReportStartupError(ex);
         Console.Error.WriteLine(ex);
         return(-1);
     }
 }
Esempio n. 3
0
        public void Run()
        {
            var args     = new string[0];
            var siloArgs = SiloArgs.ParseArguments(args);

            this.siloHost = new SiloHost(siloArgs.SiloName, Config);
            this.siloHost.LoadOrleansConfig();

            if (this.siloHost == null)
            {
                SiloArgs.PrintUsage();
                throw new ArgumentNullException(nameof(siloHost));
            }

            try
            {
                this.siloHost.InitializeOrleansSilo();

                if (this.siloHost.StartOrleansSilo())
                {
                    Console.WriteLine($"Successfully started Orleans silo '{this.siloHost.Name}' as a {this.siloHost.Type} node.");
                }
                else
                {
                    throw new OrleansException($"Failed to start Orleans silo '{this.siloHost.Name}' as a {this.siloHost.Type} node.");
                }
            }
            catch (Exception exc)
            {
                this.siloHost.ReportStartupError(exc);
                Console.Error.WriteLine(exc);
                throw new OrleansException($"Failed to start Orleans silo '{this.siloHost.Name}' as a {this.siloHost.Type} node.", exc);
            }
        }
        public int Run()
        {
            if (_siloHost == null)
            {
                SiloArgs.PrintUsage();
                return(1);
            }

            try
            {
                _siloHost.InitializeOrleansSilo();
                if (!_siloHost.StartOrleansSilo())
                {
                    throw new OrleansException($"Failed to start Orleans silo '{_siloHost.Name}' as a {_siloHost.Type} node.");
                }
                Console.WriteLine($"Successfully started Orleans silo '{_siloHost.Name}' as a {_siloHost.Type} node.");
                Console.WriteLine("OrleansHost is running. Press [Ctrl]-C to stop...");
                _siloHost.WaitForOrleansSiloShutdown();
                Console.WriteLine("OrleansHost stopped waiting, time to shut down!");
                return(0);
            }
            catch (Exception ex)
            {
                _siloHost.ReportStartupError(ex);
                Console.Error.WriteLine(ex);
                return(1);
            }
        }