Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / 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
- ToolStripSplitButton.cs
- WeakEventManager.cs
- IncrementalReadDecoders.cs
- ValuePattern.cs
- DataGridViewColumnDesignTimeVisibleAttribute.cs
- ScriptResourceMapping.cs
- ProcessManager.cs
- ButtonPopupAdapter.cs
- XPathAncestorIterator.cs
- Number.cs
- FormsAuthenticationModule.cs
- XmlWrappingReader.cs
- XmlSchemaInfo.cs
- MatrixCamera.cs
- OperatingSystem.cs
- SchemaHelper.cs
- UserPersonalizationStateInfo.cs
- ClientProxyGenerator.cs
- BitStack.cs
- SqlUDTStorage.cs
- HtmlWindow.cs
- NullableFloatMinMaxAggregationOperator.cs
- SystemFonts.cs
- QueryPageSettingsEventArgs.cs
- HwndSourceParameters.cs
- EntityChangedParams.cs
- PagerStyle.cs
- PointLight.cs
- IIS7UserPrincipal.cs
- AssemblyCollection.cs
- EndPoint.cs
- DecoderNLS.cs
- TextAnchor.cs
- TTSEngineProxy.cs
- SchemaManager.cs
- SamlAttribute.cs
- SqlNamer.cs
- LambdaCompiler.Generated.cs
- EventLogTraceListener.cs
- DataServiceQueryOfT.cs
- EditBehavior.cs
- URI.cs
- EventLogEntry.cs
- KerberosTokenFactoryCredential.cs
- PKCS1MaskGenerationMethod.cs
- Decoder.cs
- ErrorInfoXmlDocument.cs
- WorkerRequest.cs
- TemplateField.cs
- Line.cs
- FirstQueryOperator.cs
- NotificationContext.cs
- QuaternionRotation3D.cs
- PassportPrincipal.cs
- ScriptReference.cs
- ZipIOExtraField.cs
- DynamicArgumentDesigner.xaml.cs
- CompositeActivityMarkupSerializer.cs
- WrappedIUnknown.cs
- DynamicContractTypeBuilder.cs
- WebHostScriptMappingsInstallComponent.cs
- DetailsViewInsertedEventArgs.cs
- DataGridHeaderBorder.cs
- DeviceSpecificChoiceCollection.cs
- HtmlEncodedRawTextWriter.cs
- DoubleSumAggregationOperator.cs
- GenericPrincipal.cs
- DoubleCollectionValueSerializer.cs
- BindingSourceDesigner.cs
- RadialGradientBrush.cs
- SweepDirectionValidation.cs
- ReaderContextStackData.cs
- LockedHandleGlyph.cs
- prompt.cs
- SizeFConverter.cs
- CombinedGeometry.cs
- CheckBoxDesigner.cs
- BindingExpression.cs
- AspNetSynchronizationContext.cs
- XmlBaseWriter.cs
- ZipIOBlockManager.cs
- Comparer.cs
- MasterPageBuildProvider.cs
- NonParentingControl.cs
- SpecularMaterial.cs
- EnumerableRowCollection.cs
- translator.cs
- QuerySettings.cs
- Parsers.cs
- XomlCompilerHelpers.cs
- IndexedDataBuffer.cs
- SqlBulkCopyColumnMappingCollection.cs
- Timeline.cs
- __TransparentProxy.cs
- PEFileReader.cs
- SoapEnumAttribute.cs
- StoreUtilities.cs
- SelfIssuedAuthRSAPKCS1SignatureDeformatter.cs
- EntityClientCacheEntry.cs
- ConvertTextFrag.cs