ILease.SponsorshipTimeout Property

Gets or sets the amount of time to wait for a sponsor to return with a lease renewal time.

Namespace: System.Runtime.Remoting.Lifetime
Assembly: mscorlib (in mscorlib.dll)

TimeSpan SponsorshipTimeout { get; set; }
/** @property */
TimeSpan get_SponsorshipTimeout ()

/** @property */
void set_SponsorshipTimeout (TimeSpan value)

function get SponsorshipTimeout () : TimeSpan

function set SponsorshipTimeout (value : TimeSpan)

Not applicable.

Property Value

The amount of time to wait for a sponsor to return with a lease renewal time.

Exception typeCondition

SecurityException

The immediate caller makes the call through a reference to the interface and does not have infrastructure permission.

If the SponsorshipTimeout is TimeSpan.Zero, then this lease will not take sponsors.

If a sponsor does not respond to a call to renew a lease within the time-out period, it is assumed to be dead and is removed from the list of sponsors for the current lease.

The following example uses RemotingServices.GetLifetimeService to obtain an object that implements the ILease interface. To compile and run this example, you need the complete client, server, and shared library code found in the example for ILease.

// Register the channel.
TcpChannel myChannel = new TcpChannel ();
ChannelServices.RegisterChannel(myChannel);
RemotingConfiguration.RegisterActivatedClientType(
                       typeof(HelloService),"Tcp://localhost:8085");

TimeSpan myTimeSpan = TimeSpan.FromMinutes(10);

// Create a remote object.
HelloService myService = new HelloService();

ILease myLease;
myLease = (ILease)RemotingServices.GetLifetimeService(myService);
if (myLease == null)
{
   Console.WriteLine("Cannot lease.");
   return;
}

Console.WriteLine ("Initial lease time is " + myLease.InitialLeaseTime);
Console.WriteLine ("Current lease time is " + myLease.CurrentLeaseTime);
Console.WriteLine ("Renew on call time is " + myLease.RenewOnCallTime);
Console.WriteLine ("Sponsorship timeout is " + myLease.SponsorshipTimeout);
Console.WriteLine ("Current lease state is " + myLease.CurrentState.ToString());

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0
Show: