CHAPTER 18 THE .NET REMOTING LAYER (Web server on xp) 593
CHAPTER 18 THE .NET REMOTING LAYER 593 LeaseState CurrentState { get; } TimeSpan InitialLeaseTime { get; set; } TimeSpan RenewOnCallTime { get; set; } TimeSpan SponsorshipTimeout { get; set; } void Register(System.Runtime.Remoting.Lifetime.ISponsor obj); void Register(System.Runtime.Remoting.Lifetime.ISponsor obj, TimeSpan renewalTime); TimeSpan Renew(TimeSpan renewalTime); void Unregister(System.Runtime.Remoting.Lifetime.ISponsor obj); } The ILease interface not only allows you to obtain information regarding the current lease (via CurrentLeaseTime, CurrentState, and InitialLeaseTime), but also provides the ability to build lease sponsors (more details on this later). Table 18-6 documents role of each ILease member. Table 18-6. Members of the ILease Interface Member Meaning in Life CurrentLeaseTime Gets the amount of time remaining before the object deactivates, if it does not receive further method invocations. CurrentState Gets the current state of the lease, represented by the LeaseState enumeration. InitialLeaseTime Gets or sets the initial amount of time for a given lease. The initial lease time of an object is the amount of time following the initial activation before the lease expires if no other method calls occur. RenewOnCallTime Gets or sets the amount of time by which a call to the remote object increases the CurrentLeaseTime. SponsorshipTimeout Gets or sets the amount of time to wait for a sponsor to return with a lease renewal time. Register() Overloaded. Registers a sponsor for the lease. Renew() Renews a lease for the specified time. Unregister() Removes a sponsor from the sponsor list. To illustrate the characteristics of the default lease of a CAO or WKO-singleton remote object, assume that your current CAOCarGeneralAsm project has defined a new internal class named LeaseInfo. LeaseInfo supports a static member named LeaseStats(), which dumps select statistics regarding the current lease for the CarProvider type to the server-side console window (be sure to specify a using directive for the System.Runtime.Remoting.Lifetime namespace to inform the compiler where the ILease type is defined): internal class LeaseInfo { public static void LeaseStats(ILease itfLease) { Console.WriteLine(”***** Lease Stats *****”); Console.WriteLine(”Lease state: {0}”, itfLease.CurrentState); Console.WriteLine(”Initial lease time: {0}:{1}”, itfLease.InitialLeaseTime.Minutes, itfLease.InitialLeaseTime.Seconds); Console.WriteLine(”Current lease time: {0}:{1}”, itfLease.CurrentLeaseTime.Minutes, itfLease.CurrentLeaseTime.Seconds); Console.WriteLine(”Renew on call time: {0}:{1}”, itfLease.RenewOnCallTime.Minutes,
In case you need affordable webhost to host your website, our recommendation is ecommerce web host services.