Example #1
0
        public void StartDecoding(ILifetimeSponsor sponsor)
        {
            IApplication application;

            VerifyDaemonLaunched(true, out application);
            application.StartDecoding(sponsor);
        }
        public Guid RegisterSponsor(ILifetimeSponsor sponsor)
        {
            Guid cookie = Guid.NewGuid();

            lock (_sponsors)
            {
                _sponsors[cookie] = sponsor;
            }
            return(cookie);
        }
Example #3
0
        private Guid InitializeSponsorship(T remoteObject)
        {
            ILifetimeSponsor sponsor = this as ILifetimeSponsor;

            if (sponsor == null)
            {
                return(Guid.Empty);
            }
            ILifetimeBorrower borrower = remoteObject as ILifetimeBorrower;

            if (borrower == null)
            {
                return(Guid.Empty);
            }
            return(borrower.RegisterSponsor(sponsor));
        }
        private bool GetSponsorshipApproval(ILifetimeSponsor sponsor, Guid cookie, ref List <Guid> diedSponsors)
        {
            const int attemptsCount = 3;
            const int attemptsDelay = 1000;

            for (int i = 1; i <= attemptsCount; i++)
            {
                try
                {
                    return(sponsor.ShouldStayAlive());
                }
                catch (Exception)
                {
                    if (i <= attemptsCount)
                    {
                        System.Threading.Thread.Sleep(attemptsDelay);
                    }
                    diedSponsors = diedSponsors ?? new List <Guid>();
                    diedSponsors.Add(cookie);
                    return(false);
                }
            }
            return(false);
        }
Example #5
0
 public void StartDecoding(ILifetimeSponsor sponsor)
 {
     Execute(() => RemoteObject.StartDecoding(sponsor));
 }
Example #6
0
 public void StartDecoding(ILifetimeSponsor sponsor)
 {
     VerifyDisposed();
     _daemonApplication.StartDecoding(sponsor);
 }
 public void StartDecoding(ILifetimeSponsor sponsor)
 {
     sponsor = Proxy.ProxyBaseObjectHelper.ResolveRealRemoteObject <ILifetimeSponsor>(sponsor);
     _lifetimeSponsors.RegisterSponsor(sponsor);
     _currentStrategy.StartDecoding();
 }