Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / untmp / whidbey / QFE / ndp / clr / src / BCL / System / Runtime / Remoting / LeaseManager.cs / 1 / LeaseManager.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== //+---------------------------------------------------------------------------- // // Microsoft Windows // File: LeaseManager.cs // // Contents: Administers the leases in an appdomain // // History: 1/5/00[....] Created // //+--------------------------------------------------------------------------- namespace System.Runtime.Remoting.Lifetime { using System; using System.Collections; using System.Threading; internal class LeaseManager { // Lease Lists private Hashtable leaseToTimeTable = new Hashtable(); // Async Sponsor Calls //private SortedList sponsorCallList = new SortedList(); private Hashtable sponsorTable = new Hashtable(); // LeaseTimeAnalyzer thread private TimeSpan pollTime; AutoResetEvent waitHandle; TimerCallback leaseTimeAnalyzerDelegate; private volatile Timer leaseTimer; internal static bool IsInitialized() { DomainSpecificRemotingData remotingData = Thread.GetDomain().RemotingData; LeaseManager leaseManager = remotingData.LeaseManager; return leaseManager != null; } internal static LeaseManager GetLeaseManager(TimeSpan pollTime) { DomainSpecificRemotingData remotingData = Thread.GetDomain().RemotingData; LeaseManager leaseManager = remotingData.LeaseManager; if (leaseManager == null) { lock (remotingData) { if (remotingData.LeaseManager == null) { remotingData.LeaseManager = new LeaseManager(pollTime); } leaseManager = remotingData.LeaseManager; } } return leaseManager; } internal static LeaseManager GetLeaseManager() { DomainSpecificRemotingData remotingData = Thread.GetDomain().RemotingData; LeaseManager leaseManager = remotingData.LeaseManager; BCLDebug.Assert(leaseManager != null, "[LeaseManager.GetLeaseManager()]leaseManager !=null"); return leaseManager; } private LeaseManager(TimeSpan pollTime) { BCLDebug.Trace("REMOTE","LeaseManager Constructor"); this.pollTime = pollTime; leaseTimeAnalyzerDelegate = new TimerCallback(this.LeaseTimeAnalyzer); waitHandle = new AutoResetEvent(false); // We need to create a Timer with Infinite dueTime to ensure that // leaseTimeAnalyzerDelegate doesnt get invoked before leaseTimer is initialized // Once initialized we can change it to the appropriate dueTime leaseTimer = new Timer(leaseTimeAnalyzerDelegate, null, Timeout.Infinite, Timeout.Infinite); leaseTimer.Change((int)pollTime.TotalMilliseconds, Timeout.Infinite); } internal void ChangePollTime(TimeSpan pollTime) { BCLDebug.Trace("REMOTE","LeaseManager ChangePollTime ", pollTime); this.pollTime = pollTime; } internal void ActivateLease(Lease lease) { BCLDebug.Trace("REMOTE","LeaseManager AddLease ",lease.id," ",lease.managedObject); lock(leaseToTimeTable) { leaseToTimeTable[lease] = lease.leaseTime; } } internal void DeleteLease(Lease lease) { BCLDebug.Trace("REMOTE","LeaseManager DeleteLease ",lease.id); lock(leaseToTimeTable) { leaseToTimeTable.Remove(lease); } } [System.Diagnostics.Conditional("_LOGGING")] internal void DumpLeases(Lease[] leases) { for (int i=0; i
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- PageRanges.cs
- XamlVector3DCollectionSerializer.cs
- FilterableAttribute.cs
- CommandEventArgs.cs
- BaseDataBoundControl.cs
- AlignmentYValidation.cs
- XpsImage.cs
- HtmlInputReset.cs
- ThreadPool.cs
- WindowsFormsEditorServiceHelper.cs
- ClientBuildManagerCallback.cs
- ReadOnlyCollection.cs
- ResolveNameEventArgs.cs
- TableLayoutSettings.cs
- URLString.cs
- Binding.cs
- SkinBuilder.cs
- TypeReference.cs
- XmlWhitespace.cs
- MemoryPressure.cs
- CalendarItem.cs
- FreezableCollection.cs
- SystemUdpStatistics.cs
- UiaCoreApi.cs
- GridEntryCollection.cs
- PolyQuadraticBezierSegment.cs
- SecurityHelper.cs
- DiagnosticsConfigurationHandler.cs
- CngKey.cs
- TableItemPattern.cs
- DataTableExtensions.cs
- BrowserDefinition.cs
- ToolBar.cs
- PageBreakRecord.cs
- EntityObject.cs
- AuthenticationServiceManager.cs
- ValidationHelpers.cs
- PageAdapter.cs
- DoubleIndependentAnimationStorage.cs
- TextWriter.cs
- MimeBasePart.cs
- BindingMemberInfo.cs
- DrawingBrush.cs
- CustomExpression.cs
- ObjectStateFormatter.cs
- BasicExpandProvider.cs
- XmlSecureResolver.cs
- DBConnectionString.cs
- KeyedHashAlgorithm.cs
- ObfuscateAssemblyAttribute.cs
- PeerPresenceInfo.cs
- FrameworkElement.cs
- XmlDataDocument.cs
- CodeSubDirectoriesCollection.cs
- CollectionViewProxy.cs
- UpdatePanelControlTrigger.cs
- TargetControlTypeCache.cs
- TextEditorLists.cs
- UIElement3DAutomationPeer.cs
- Style.cs
- BezierSegment.cs
- ColorAnimationUsingKeyFrames.cs
- UICuesEvent.cs
- PtsHelper.cs
- UndirectedGraph.cs
- CharacterBuffer.cs
- TrustVersion.cs
- WebZoneDesigner.cs
- _SslStream.cs
- ItemCheckEvent.cs
- XmlAttributeCollection.cs
- WindowInteractionStateTracker.cs
- VirtualPath.cs
- WebPartEditorCancelVerb.cs
- QilList.cs
- ContractHandle.cs
- InvalidComObjectException.cs
- DataGridViewLinkColumn.cs
- WebPartConnectionsEventArgs.cs
- RegexParser.cs
- ResourceKey.cs
- _LazyAsyncResult.cs
- InstanceDataCollection.cs
- ActivityLocationReferenceEnvironment.cs
- StaticFileHandler.cs
- PolicyVersionConverter.cs
- HandlerWithFactory.cs
- VirtualPathProvider.cs
- QualificationDataAttribute.cs
- LocatorBase.cs
- ContextMarshalException.cs
- TextEditorTables.cs
- EventPropertyMap.cs
- HtmlTableCellCollection.cs
- DataBindingCollection.cs
- CounterSetInstance.cs
- DirectoryObjectSecurity.cs
- PointCollectionValueSerializer.cs
- DragSelectionMessageFilter.cs
- DetailsViewCommandEventArgs.cs