Export (0) Print
Expand All

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 class ILease

The ILease type exposes the following members.

  NameDescription
Public propertyCurrentLeaseTimeGets the amount of time remaining on the lease.
Public propertyCurrentStateGets the current LeaseState of the lease.
Public propertyInitialLeaseTimeGets or sets the initial time for the lease.
Public propertyRenewOnCallTimeGets or sets the amount of time by which a call to the remote object renews the CurrentLeaseTime.
Public propertySponsorshipTimeoutGets or sets the amount of time to wait for a sponsor to return with a lease renewal time.
Top

  NameDescription
Public methodRegister(ISponsor)Registers a sponsor for the lease without renewing the lease.
Public methodRegister(ISponsor, TimeSpan)Registers a sponsor for the lease, and renews it by the specified TimeSpan.
Public methodRenewRenews a lease for the specified time.
Public methodUnregisterRemoves 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.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft