Configuring Object Lifetime

In the example used so far, no special code is used to configure the lifetime of the remote object. For a SingleCall object, no such code is required because the object is automatically destroyed at the end of each method call. For client-activated or singleton objects, however, the remote object is automatically destroyed if it is inactive for 2 minutes, provided it has been in existence for at least 5 minutes. These magic numbers are just the default properties of the lifetime lease automatically assigned to every remote object. They are encapsulated by the ILease interface in the System.Runtime.Remoting.Lifetime namespace. Table 4-2 lists the properties of the ILease interface.

Table 4-2. Lease Properties

Property ...

Get Microsoft® .NET Distributed Applications: Integrating XML Web Services and .NET Remoting now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.