Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / clr / src / BCL / System / Runtime / Remoting / ClientSponsor.cs / 1 / ClientSponsor.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== //+---------------------------------------------------------------------------- // // File: ClientSponsor.cs // // Contents: Agent for keeping Server Object's lifetime in sync with a client's lifetime // // History: 8/9/00[....] Created // //+--------------------------------------------------------------------------- namespace System.Runtime.Remoting.Lifetime { using System; using System.Collections; using System.Security.Permissions; [SecurityPermissionAttribute(SecurityAction.LinkDemand, Flags=SecurityPermissionFlag.Infrastructure)] [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;} } 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; } 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 public TimeSpan Renewal(ILease lease) { BCLDebug.Trace("REMOTE", "ClientSponsor Renewal "+m_renewalTime); return m_renewalTime; } 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 public override Object InitializeLifetimeService() { return null; } ~ClientSponsor() { BCLDebug.Trace("REMOTE","ClientSponsor Finalize"); } } }
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- QilBinary.cs
- ColumnResizeAdorner.cs
- InternalException.cs
- SingleObjectCollection.cs
- InkPresenter.cs
- RuleRef.cs
- RegexGroup.cs
- NamedPipeTransportElement.cs
- XmlSchemaDatatype.cs
- ObjectQueryState.cs
- _StreamFramer.cs
- IndexedEnumerable.cs
- StickyNoteHelper.cs
- InputLanguageManager.cs
- ControlCodeDomSerializer.cs
- StringUtil.cs
- SolidColorBrush.cs
- SingleObjectCollection.cs
- EntityKeyElement.cs
- NativeWindow.cs
- _ListenerResponseStream.cs
- TextTreeTextNode.cs
- XmlRawWriter.cs
- TextDataBindingHandler.cs
- ColumnResizeAdorner.cs
- SRDisplayNameAttribute.cs
- HandledEventArgs.cs
- CloseCryptoHandleRequest.cs
- ServiceElement.cs
- ISAPIWorkerRequest.cs
- CodeTypeDeclarationCollection.cs
- SchemaAttDef.cs
- ReaderWriterLock.cs
- OracleBinary.cs
- CacheSection.cs
- ExpressionList.cs
- StandardToolWindows.cs
- UriParserTemplates.cs
- SqlUserDefinedTypeAttribute.cs
- PartialCachingControl.cs
- EventHandlersStore.cs
- HtmlGenericControl.cs
- _ConnectionGroup.cs
- Decoder.cs
- SecurityCapabilities.cs
- WorkflowFileItem.cs
- PrintPreviewGraphics.cs
- httpserverutility.cs
- ColorAnimation.cs
- _ConnectOverlappedAsyncResult.cs
- DecimalAnimation.cs
- WindowsSolidBrush.cs
- ZipIOModeEnforcingStream.cs
- DocumentPaginator.cs
- IndexedGlyphRun.cs
- DbMetaDataFactory.cs
- SessionEndingEventArgs.cs
- WebPartConnection.cs
- UnsafeNativeMethods.cs
- CodeAttributeArgument.cs
- TableColumn.cs
- ToolStripInSituService.cs
- ExceptionUtil.cs
- InstanceDataCollectionCollection.cs
- KeyPressEvent.cs
- SafeFreeMibTable.cs
- ObfuscateAssemblyAttribute.cs
- sqlpipe.cs
- ExpressionBuilderContext.cs
- _RequestCacheProtocol.cs
- PropertyItemInternal.cs
- UiaCoreApi.cs
- WindowsSysHeader.cs
- TypeUtil.cs
- BoolExpressionVisitors.cs
- UndirectedGraph.cs
- MenuStrip.cs
- ObjectDataSourceFilteringEventArgs.cs
- SafeFileMapViewHandle.cs
- GridToolTip.cs
- PathTooLongException.cs
- SafeNativeMethods.cs
- OpenTypeMethods.cs
- ServiceParser.cs
- SqlGenericUtil.cs
- ProfileGroupSettings.cs
- SystemIPv4InterfaceProperties.cs
- XmlDataContract.cs
- ToolStrip.cs
- HMACSHA1.cs
- ItemMap.cs
- TraceInternal.cs
- MediaCommands.cs
- TextPatternIdentifiers.cs
- AffineTransform3D.cs
- WmlControlAdapter.cs
- Page.cs
- SearchForVirtualItemEventArgs.cs
- AutomationAttributeInfo.cs
- AnimationException.cs