示例#1
0
        public void Dispose()
        {
            if (disposeState != DisposeState.Active)
            {
                return;
            }
            lock (sync)
            {
                if (disposeState != DisposeState.Active)
                {
                    return;
                }
                disposeState = DisposeState.Disposing;

                if (rootItem != null)
                {
                    try
                    {
                        Ping.Dispose();
                    }
                    catch (Exception e)
                    {
                        logErr(e);
                    }
                    try
                    {
                        startupSubscription?.Dispose();
                        startupSubscription = null;
                    }
                    catch (Exception e)
                    {
                        logErr(e);
                    }
                    try
                    {
                        rootItem.Actor.Children.Values
                        .OrderByDescending(c => c.Actor.Id == User)     // shutdown "user" first
                        .Iter(c => c.Actor.ShutdownProcess(true));
                    }
                    catch (Exception e)
                    {
                        logErr(e);
                    }
                    cluster.IfSome(c => c?.Dispose());
                }
                rootItem     = null;
                disposeState = DisposeState.Disposed;
            }
        }
示例#2
0
 public void Dispose()
 {
     lock (sync)
     {
         var ri = rootItem;
         rootItem = null;
         if (ri != null)
         {
             try
             {
                 Ping.Dispose();
             }
             catch (Exception e)
             {
                 logErr(e);
             }
             try
             {
                 startupSubscription?.Dispose();
                 startupSubscription = null;
             }
             catch (Exception e)
             {
                 logErr(e);
             }
             try
             {
                 var item = ri;
                 ri.Actor.Children.Iter(c => c.Actor.ShutdownProcess(true));
             }
             catch (Exception e)
             {
                 logErr(e);
             }
             cluster.IfSome(c => c?.Dispose());
         }
     }
 }