This topic has not yet been rated - Rate this topic

ILease Interface

Defines a lifetime lease object that is used by the remoting lifetime service.

Namespace:  System.Runtime.Remoting.Lifetime
Assembly:  mscorlib (in mscorlib.dll)
[ComVisibleAttribute(true)]
public interface ILease

The ILease type exposes the following members.

  Name Description
Public property CurrentLeaseTime Gets the amount of time remaining on the lease.
Public property CurrentState Gets the current LeaseState of the lease.
Public property InitialLeaseTime Gets or sets the initial time for the lease.
Public property RenewOnCallTime Gets or sets the amount of time by which a call to the remote object renews the CurrentLeaseTime.
Public property SponsorshipTimeout Gets or sets the amount of time to wait for a sponsor to return with a lease renewal time.
Top
  Name Description
Public method Register(ISponsor) Registers a sponsor for the lease without renewing the lease.
Public method Register(ISponsor, TimeSpan) Registers a sponsor for the lease, and renews it by the specified TimeSpan.
Public method Renew Renews a lease for the specified time.
Public method Unregister Removes a sponsor from the sponsor list.
Top

Distributed garbage collection controls when server applications can be deleted. Traditionally, distributed garbage collection uses reference counts and pinging for control. This works well when there are a few clients per object, but does not work well when there are thousands of clients per each object. The lifetime service can assume the function of a traditional distributed garbage collector, and scales well when the number of clients increases.

The lifetime service associates a lease with each remotely activated object. When the lease expires, the object is removed. A lease can specify that an object has an infinite lifetime.

Each AppDomain contains a lease manager that administers the leases in the domain. The lease manager periodically examines the leases for time expiration. If a lease has expired, it can either be canceled by removing its reference to the lease, or renewed by invoking one or more of the lease's sponsors.

A lease contains properties that determine its policies, and methods that renew the lease time. The lease exposes the ILease interface.

For an example showing how to use the ILease interface see Lifetimes.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ