Exemplo n.º 1
0
 internal static void OnPreShutdown(ShutdownCancellationToken cancel)
 {
     preShutdownSubj.OnNext(cancel);
     if (!cancel.Cancelled)
     {
         preShutdownSubj.OnCompleted();
     }
 }
Exemplo n.º 2
0
        public static Unit StopSystem(SystemName system)
        {
            lock (sync)
            {
                if (context == system)
                {
                    context = default(SystemName);
                }

                if (defaultSystem == system)
                {
                    defaultSystem = default(SystemName);
                }

                ActorSystem asystem = null;
                var         token   = new ShutdownCancellationToken(system);
                try
                {
                    Process.OnPreShutdown(token);
                }
                finally
                {
                    if (!token.Cancelled)
                    {
                        try
                        {
                            asystem = FindSystem(system);
                            if (asystem != null)
                            {
                                asystem.Dispose();
                            }
                        }
                        finally
                        {
                            RemoveSystem(system);
                            Process.OnShutdown(system);
                        }
                    }
                }
                return(unit);
            }
        }