Ejemplo n.º 1
0
 internal Lease(
     TimeSpan initialLeaseTime,
     TimeSpan renewOnCallTime,
     TimeSpan sponsorshipTimeout,
     MarshalByRefObject managedObject)
 {
     this.id = Lease.nextId++;
     this.renewOnCallTime    = renewOnCallTime;
     this.sponsorshipTimeout = sponsorshipTimeout;
     this.initialLeaseTime   = initialLeaseTime;
     this.managedObject      = managedObject;
     this.leaseManager       = LeaseManager.GetLeaseManager();
     this.sponsorTable       = new Hashtable(10);
     this.state = LeaseState.Initial;
 }
Ejemplo n.º 2
0
        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);
        }