Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / clr / src / BCL / System / Runtime / Remoting / LeaseManager.cs / 1305376 / 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; } [System.Security.SecurityCritical] // auto-generated 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; } [System.Security.SecurityCritical] // auto-generated 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
- Int32Converter.cs
- SqlCacheDependencyDatabaseCollection.cs
- RelationHandler.cs
- RadioButton.cs
- RoleManagerModule.cs
- DbProviderConfigurationHandler.cs
- ChannelRequirements.cs
- GlyphRun.cs
- IdnElement.cs
- clipboard.cs
- OptimisticConcurrencyException.cs
- DataPagerField.cs
- ValidationService.cs
- CustomAttributeBuilder.cs
- FontNamesConverter.cs
- SerializerDescriptor.cs
- FileAuthorizationModule.cs
- WindowsListViewItem.cs
- QilGenerator.cs
- GeneralTransform2DTo3D.cs
- CaseStatement.cs
- ResourceProviderFactory.cs
- EUCJPEncoding.cs
- TrustLevel.cs
- PersonalizationStateQuery.cs
- ApplicationDirectory.cs
- MultiTrigger.cs
- WebResourceAttribute.cs
- ReadWriteSpinLock.cs
- PersonalizationProvider.cs
- AssertSection.cs
- SoundPlayer.cs
- SchemaConstraints.cs
- EdmRelationshipNavigationPropertyAttribute.cs
- UrlPath.cs
- base64Transforms.cs
- HostedTransportConfigurationManager.cs
- UIAgentMonitorHandle.cs
- CustomValidator.cs
- CssStyleCollection.cs
- RequestCachingSection.cs
- ModulesEntry.cs
- HtmlContainerControl.cs
- DebuggerAttributes.cs
- SplitterPanel.cs
- BitmapPalettes.cs
- JoinTreeNode.cs
- AxisAngleRotation3D.cs
- SourceFileInfo.cs
- ImageListUtils.cs
- CompiledQueryCacheEntry.cs
- DataChangedEventManager.cs
- EdmProperty.cs
- OdbcFactory.cs
- QilFunction.cs
- AvTraceDetails.cs
- StrokeNodeOperations2.cs
- TextRange.cs
- WhitespaceRule.cs
- SByteStorage.cs
- MaterialCollection.cs
- AnimationStorage.cs
- PartialCachingAttribute.cs
- MultiPageTextView.cs
- safex509handles.cs
- IxmlLineInfo.cs
- Bind.cs
- ICspAsymmetricAlgorithm.cs
- ScrollPatternIdentifiers.cs
- HtmlDocument.cs
- UIElement.cs
- QilUnary.cs
- DbModificationCommandTree.cs
- WriteTimeStream.cs
- webproxy.cs
- UnhandledExceptionEventArgs.cs
- AccessDataSourceView.cs
- ProxyHwnd.cs
- BStrWrapper.cs
- EncoderFallback.cs
- RankException.cs
- SelectManyQueryOperator.cs
- ResourceReferenceExpressionConverter.cs
- D3DImage.cs
- OuterGlowBitmapEffect.cs
- GenericPrincipal.cs
- KoreanLunisolarCalendar.cs
- ChannelServices.cs
- AdapterUtil.cs
- Button.cs
- DockPattern.cs
- EventManager.cs
- Module.cs
- Update.cs
- XslVisitor.cs
- WindowsFormsEditorServiceHelper.cs
- SystemBrushes.cs
- DATA_BLOB.cs
- HashCodeCombiner.cs
- Profiler.cs