コード例 #1
0
        public TimeSpan Renewal(System.Runtime.Remoting.Lifetime.ILease lease)
        {
            Console.WriteLine("{0} SPONSOR: Renewal() called", DateTime.Now);

            if (doRenewal)
            {
                Console.WriteLine("{0} SPONSOR: Will renew (10 secs) ", DateTime.Now);
                return(TimeSpan.FromSeconds(10));
            }
            else
            {
                Console.WriteLine("{0} SPONSOR: Won't renew further", DateTime.Now);
                return(TimeSpan.Zero);
            }
        }
コード例 #2
0
        public TimeSpan Renewal(System.Runtime.Remoting.Lifetime.ILease lease)
        {
            Console.WriteLine("{0} SPONSOR: Renewal() called", DateTime.Now);

            // keepalive needs to be called at least every 5 seconds
            TimeSpan duration = DateTime.Now.Subtract(lastKeepAlive);

            if (duration.TotalSeconds < 5)
            {
                Console.WriteLine("{0} SPONSOR: Will renew (10 secs) ",
                                  DateTime.Now);
                return(TimeSpan.FromSeconds(10));
            }
            else
            {
                Console.WriteLine("{0} SPONSOR: Won't renew further", DateTime.Now);
                return(TimeSpan.Zero);
            }
        }