Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / clr / src / BCL / System / Runtime / Remoting / ClientSponsor.cs / 1305376 / ClientSponsor.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== //+---------------------------------------------------------------------------- // // File: ClientSponsor.cs // // Contents: Agent for keeping Server Object's lifetime in [....] with a client's lifetime // // History: 8/9/00[....] Created // //+--------------------------------------------------------------------------- namespace System.Runtime.Remoting.Lifetime { using System; using System.Collections; using System.Security.Permissions; [System.Security.SecurityCritical] // auto-generated_required [SecurityPermissionAttribute(SecurityAction.InheritanceDemand, Flags=SecurityPermissionFlag.Infrastructure)] [System.Runtime.InteropServices.ComVisible(true)] public class ClientSponsor : MarshalByRefObject, ISponsor { private Hashtable sponsorTable = new Hashtable(10); private TimeSpan m_renewalTime = TimeSpan.FromMinutes(2); public ClientSponsor() { } public ClientSponsor(TimeSpan renewalTime) { this.m_renewalTime = renewalTime; } public TimeSpan RenewalTime { get{ return m_renewalTime;} set{ m_renewalTime = value;} } [System.Security.SecurityCritical] // auto-generated public bool Register(MarshalByRefObject obj) { BCLDebug.Trace("REMOTE", "ClientSponsor Register "+obj); ILease lease = (ILease)obj.GetLifetimeService(); if (lease == null) return false; lease.Register(this); lock(sponsorTable) { sponsorTable[obj] = lease; } return true; } [System.Security.SecurityCritical] // auto-generated public void Unregister(MarshalByRefObject obj) { BCLDebug.Trace("REMOTE", "ClientSponsor Unregister "+obj); ILease lease = null; lock(sponsorTable) { lease = (ILease)sponsorTable[obj]; } if (lease != null) lease.Unregister(this); } // ISponsor method [System.Security.SecurityCritical] public TimeSpan Renewal(ILease lease) { BCLDebug.Trace("REMOTE", "ClientSponsor Renewal "+m_renewalTime); return m_renewalTime; } [System.Security.SecurityCritical] // auto-generated public void Close() { BCLDebug.Trace("REMOTE","ClientSponsor Close"); lock(sponsorTable) { IDictionaryEnumerator e = sponsorTable.GetEnumerator(); while(e.MoveNext()) ((ILease)e.Value).Unregister(this); sponsorTable.Clear(); } } // Don't create a lease on the sponsor [System.Security.SecurityCritical] public override Object InitializeLifetimeService() { return null; } [System.Security.SecuritySafeCritical] // finalizers should be treated as safe ~ClientSponsor() { BCLDebug.Trace("REMOTE","ClientSponsor Finalize"); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SqlFormatter.cs
- TextSearch.cs
- DataGridViewCellValidatingEventArgs.cs
- TdsParserStaticMethods.cs
- TypeUnloadedException.cs
- DoubleMinMaxAggregationOperator.cs
- XmlEnumAttribute.cs
- ThicknessAnimation.cs
- StateChangeEvent.cs
- AlphaSortedEnumConverter.cs
- AttributeEmitter.cs
- SimpleApplicationHost.cs
- QilName.cs
- PropertiesTab.cs
- ImageCodecInfoPrivate.cs
- ToolboxItemFilterAttribute.cs
- XmlWrappingReader.cs
- DataGridParentRows.cs
- BoundColumn.cs
- _ChunkParse.cs
- GPPOINT.cs
- UIElementParagraph.cs
- SoapSchemaMember.cs
- AggregatePushdown.cs
- EdgeModeValidation.cs
- AuthorizationContext.cs
- ApplicationException.cs
- Int32KeyFrameCollection.cs
- LinkedResourceCollection.cs
- TrackingRecordPreFilter.cs
- PageBreakRecord.cs
- XPathSelectionIterator.cs
- PointHitTestParameters.cs
- MaskDescriptor.cs
- COAUTHINFO.cs
- BindingRestrictions.cs
- TemplatedControlDesigner.cs
- JoinElimination.cs
- RegisteredArrayDeclaration.cs
- IteratorFilter.cs
- StateManagedCollection.cs
- SqlColumnizer.cs
- ComponentChangedEvent.cs
- ConfigurationLoaderException.cs
- UTF7Encoding.cs
- IResourceProvider.cs
- UpdatePanelControlTrigger.cs
- SiteMap.cs
- Point3DCollectionValueSerializer.cs
- DrawListViewSubItemEventArgs.cs
- SplitterCancelEvent.cs
- ZeroOpNode.cs
- ManagementObjectCollection.cs
- XPathSingletonIterator.cs
- DataBindingExpressionBuilder.cs
- DataControlPagerLinkButton.cs
- coordinatorscratchpad.cs
- PeerResolver.cs
- XmlUtil.cs
- Stream.cs
- CompilerTypeWithParams.cs
- ObjectQueryProvider.cs
- CacheEntry.cs
- Part.cs
- x509utils.cs
- ComplusTypeValidator.cs
- HashSetDebugView.cs
- Point.cs
- SiteMapNodeCollection.cs
- LogicalExpr.cs
- FontStyles.cs
- GlobalAclOperationRequirement.cs
- DefinitionBase.cs
- EncoderReplacementFallback.cs
- LinkLabelLinkClickedEvent.cs
- IPPacketInformation.cs
- TemplatedControlDesigner.cs
- EpmAttributeNameBuilder.cs
- ProcessRequestArgs.cs
- UTF7Encoding.cs
- DateTimeConverter.cs
- XmlSchemaType.cs
- Interop.cs
- FragmentNavigationEventArgs.cs
- SqlUDTStorage.cs
- TypeSchema.cs
- RegexCode.cs
- Bidi.cs
- PackageRelationshipCollection.cs
- CurrencyWrapper.cs
- WindowsStatic.cs
- KoreanLunisolarCalendar.cs
- AddInController.cs
- TreeNodeSelectionProcessor.cs
- PenThreadPool.cs
- TypefaceMap.cs
- PixelFormatConverter.cs
- ConfigurationSectionGroup.cs
- DataGridViewColumnConverter.cs
- XsltSettings.cs