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
- ButtonChrome.cs
- TypeConverterHelper.cs
- Pens.cs
- HostingEnvironmentException.cs
- PlaceHolder.cs
- NamespaceEmitter.cs
- PrintDocument.cs
- LocatorBase.cs
- ConfigPathUtility.cs
- MetaTableHelper.cs
- StringConverter.cs
- Int64Storage.cs
- DBProviderConfigurationHandler.cs
- ParallelActivityDesigner.cs
- UnauthorizedWebPart.cs
- SuppressMergeCheckAttribute.cs
- ProviderCommandInfoUtils.cs
- TdsParserHelperClasses.cs
- NameValueFileSectionHandler.cs
- AnnotationAuthorChangedEventArgs.cs
- ApplicationTrust.cs
- DbExpressionBuilder.cs
- ServiceNameCollection.cs
- SQLGuid.cs
- _ShellExpression.cs
- CodeCatchClause.cs
- FlowDecisionDesigner.xaml.cs
- TextSpan.cs
- FontNamesConverter.cs
- XmlSchemaObjectCollection.cs
- EncodingNLS.cs
- ToolStripArrowRenderEventArgs.cs
- WebHttpSecurityElement.cs
- BrowserDefinition.cs
- Command.cs
- Util.cs
- Rect.cs
- AdRotatorDesigner.cs
- DataGridRowHeader.cs
- ControlAdapter.cs
- BindingNavigator.cs
- InfoCardListRequest.cs
- PointAnimationUsingKeyFrames.cs
- EventLogRecord.cs
- DetailsViewRow.cs
- XmlDataSourceView.cs
- HierarchicalDataSourceControl.cs
- DataGridClipboardHelper.cs
- Int32AnimationBase.cs
- XmlSchemaCompilationSettings.cs
- NodeLabelEditEvent.cs
- SimpleTextLine.cs
- ProxyManager.cs
- BitmapImage.cs
- PageSetupDialog.cs
- DNS.cs
- OutgoingWebResponseContext.cs
- Point4D.cs
- ProtocolViolationException.cs
- XpsResourcePolicy.cs
- DiagnosticsElement.cs
- EnvelopedSignatureTransform.cs
- Inline.cs
- OutputScopeManager.cs
- ChtmlTextWriter.cs
- DbParameterHelper.cs
- StrongTypingException.cs
- VarRemapper.cs
- DesignerActionList.cs
- FaultDescription.cs
- RegexCompiler.cs
- InvalidAsynchronousStateException.cs
- Rights.cs
- Identity.cs
- PaperSource.cs
- MissingMemberException.cs
- ApplyImportsAction.cs
- DropAnimation.xaml.cs
- KeyboardNavigation.cs
- Shape.cs
- EntityChangedParams.cs
- FieldBuilder.cs
- HScrollBar.cs
- DynamicValidator.cs
- StorageAssociationTypeMapping.cs
- CancellationHandler.cs
- ObjectListCommandCollection.cs
- ProxyWebPartManager.cs
- figurelength.cs
- DateTimeSerializationSection.cs
- FormsAuthenticationModule.cs
- RequestCacheEntry.cs
- GridView.cs
- DES.cs
- StreamGeometry.cs
- FormViewRow.cs
- ImpersonationContext.cs
- ListView.cs
- ScriptMethodAttribute.cs
- AddInPipelineAttributes.cs