System.Runtime.Remoting.Lifetime.ClientSponsor Class

Assembly: Mscorlib.dll
Namespace: System.Runtime.Remoting.Lifetime
Summary
Provides a default implementation for a lifetime sponsor class.
C# Syntax:
public class ClientSponsor : MarshalByRefObject, ISponsor
Remarks
The current lifetime sponsor implementation can be used to sponsor objects by specifying the required renewal TimeSpan.
See also:
System.Runtime.Remoting.Lifetime Namespace

System.Runtime.Remoting.Lifetime.ClientSponsor Member List:

Public Constructors
ctor #1 Overloaded:
.ctor()

Default constructor. This constructor is called by derived class constructors to initialize state in this type.
Initializes a new instance of the ClientSponsor class with default values.
ctor #2 Overloaded:
.ctor(TimeSpan renewalTime)

Initializes a new instance of the ClientSponsor class with the renewal time of the sponsored object.
Public Properties
RenewalTime Read-write

Gets or sets the TimeSpan by which to increase the lifetime of the sponsored objects when renewal is requested.
Public Methods
Close Empties the list objects registered with the current ClientSponsor.
CreateObjRef
(inherited from System.MarshalByRefObject)
See base class member description: System.MarshalByRefObject.CreateObjRef


Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.
Equals
(inherited from System.Object)
See base class member description: System.Object.Equals

Derived from System.Object, the primary base class for all objects.
GetHashCode
(inherited from System.Object)
See base class member description: System.Object.GetHashCode

Derived from System.Object, the primary base class for all objects.
GetLifetimeService
(inherited from System.MarshalByRefObject)
See base class member description: System.MarshalByRefObject.GetLifetimeService


Retrieves the current lifetime service object that controls the lifetime policy for this instance.
GetType
(inherited from System.Object)
See base class member description: System.Object.GetType

Derived from System.Object, the primary base class for all objects.
InitializeLifetimeService Overridden:
Initializes a new instance of ClientSponsor, providing a lease for the current object.
Register Registers the specified MarshalByRefObject for sponsorship.
Renewal Requests a sponsoring client to renew the lease for the specified object.
ToString
(inherited from System.Object)
See base class member description: System.Object.ToString

Derived from System.Object, the primary base class for all objects.
Unregister Unregisters the specified MarshalByRefObject from the list of objects sponsored by the current ClientSponsor.
Protected Methods
Finalize Overridden:
Frees the resources of the current ClientSponsor before the garbage collector reclaims them.
MemberwiseClone
(inherited from System.Object)
See base class member description: System.Object.MemberwiseClone

Derived from System.Object, the primary base class for all objects.

Hierarchy:


System.Runtime.Remoting.Lifetime.ClientSponsor Member Details

Overloaded ctor #1
Summary
Initializes a new instance of the ClientSponsor class with default values.

Default constructor. This constructor is called by derived class constructors to initialize state in this type.
C# Syntax:
public ClientSponsor();
Remarks
The default time by which the lifetime of a sponsored object is increased when renewal is requested to 2 minutes. For more information on the renewal time, see the LifetimeServices.RenewOnCallTime property.

Return to top


Overloaded ctor #2
Summary
Initializes a new instance of the ClientSponsor class with the renewal time of the sponsored object.
C# Syntax:
public ClientSponsor(
   TimeSpan renewalTime
);
Parameters:

renewalTime

The TimeSpan by which to increase the lifetime of the sponsored objects when renewal is requested.

Return to top


Property: RenewalTime (read-write)
Summary
Gets or sets the TimeSpan by which to increase the lifetime of the sponsored objects when renewal is requested.
C# Syntax:
public TimeSpan RenewalTime {get; set;}

Return to top


Method: Close()
Summary
Empties the list objects registered with the current ClientSponsor.
C# Syntax:
public void Close();

Return to top


Method: CreateObjRef(
   Type requestedType
)
Inherited
See base class member description: System.MarshalByRefObject.CreateObjRef

Summary
Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.
C# Syntax:
public virtual ObjRef CreateObjRef(
   Type requestedType
);
Parameters:

requestedType

The Type of the object that the new ObjRef will reference.

Return Value:
Information required to generate a proxy.
Exceptions
Exception Type Condition
RemotingException This instance is not a valid remoting object.

Return to top


Method: Equals(
   object obj
)
Inherited
See base class member description: System.Object.Equals
C# Syntax:
public virtual bool Equals(
   object obj
);

For more information on members inherited from System.Object click on the link above.

Return to top


Overridden Method: Finalize()
Summary
Frees the resources of the current ClientSponsor before the garbage collector reclaims them.
C# Syntax:
~ClientSponsor();

Return to top


Method: GetHashCode()
Inherited
See base class member description: System.Object.GetHashCode
C# Syntax:
public virtual int GetHashCode();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: GetLifetimeService()
Inherited
See base class member description: System.MarshalByRefObject.GetLifetimeService

Summary
Retrieves the current lifetime service object that controls the lifetime policy for this instance.
C# Syntax:
public object GetLifetimeService();
Return Value:
An object of type ILease used to control the lifetime policy for this instance.
Remarks
For more information about lifetime services, see the LifetimeServices class.

Return to top


Method: GetType()
Inherited
See base class member description: System.Object.GetType
C# Syntax:
public Type GetType();

For more information on members inherited from System.Object click on the link above.

Return to top


Overridden Method: InitializeLifetimeService()
Summary
Initializes a new instance of ClientSponsor, providing a lease for the current object.
C# Syntax:
public override object InitializeLifetimeService();
Return Value:
An ILease for the current object.
Remarks
For more information on the current method, see MarshalByRefObject.InitializeLifetimeService.
See also:
InitializeLifetimeService

Return to top


Method: MemberwiseClone()
Inherited
See base class member description: System.Object.MemberwiseClone
C# Syntax:
protected object MemberwiseClone();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: Register(
   MarshalByRefObject obj
)
Summary
Registers the specified MarshalByRefObject for sponsorship.
C# Syntax:
public bool Register(
   MarshalByRefObject obj
);
Parameters:

obj

The object to register for sponsorship with the ClientSponsor.

Return Value:
true if registration succeeded; otherwise, false.

Return to top


Method: Renewal(
   ILease lease
)
Summary
Requests a sponsoring client to renew the lease for the specified object.
C# Syntax:
public TimeSpan Renewal(
   ILease lease
);
Parameters:

lease

The lifetime lease of the object that requires lease renewal.

Return Value:
The additional lease time for the specified object.
Implements:
ISponsor.Renewal
Remarks
The ISponsor.Renewal method is called by the distributed garbage collector to renew the lease for the specified object.

Return to top


Method: ToString()
Inherited
See base class member description: System.Object.ToString
C# Syntax:
public virtual string ToString();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: Unregister(
   MarshalByRefObject obj
)
Summary
Unregisters the specified MarshalByRefObject from the list of objects sponsored by the current ClientSponsor.
C# Syntax:
public void Unregister(
   MarshalByRefObject obj
);
Parameters:

obj

The object to unregister.

Return to top


Top of page

Copyright (c) 2002 Microsoft Corporation. All rights reserved.