예제 #1
0
		public PersistentInterest(AsyncRef asyncRef)
		{
			this.interestList = new InterestList();
			this.interestList.Add(asyncRef);
			this.interestList.Activate();
			asyncRef.AddCallback(new AsyncRecord.CompleteCallback(this.AsyncCompleteCallback));
		}
        public override Present Realize(string refCredit)
        {
            Monitor.Enter(this);
            Present result;

            try
            {
                if (activeAsyncRef != null)
                {
                    result = activeAsyncRef.Duplicate(refCredit);
                }
                else
                {
                    D.Assert(!realizing);
                    realizing      = true;
                    activeAsyncRef = (AsyncRef)future.Realize("ODSPF");
                    AsyncRef asyncRef = (AsyncRef)activeAsyncRef.Duplicate(refCredit);
                    prioritizer.Realizing(this);
                    activeAsyncRef.AddCallback(AsyncCompleteCallback);
                    result = asyncRef;
                }
            }
            finally
            {
                Monitor.Exit(this);
            }

            return(result);
        }
예제 #3
0
 public PersistentInterest(AsyncRef asyncRef)
 {
     this.interestList = new InterestList();
     this.interestList.Add(asyncRef);
     this.interestList.Activate();
     asyncRef.AddCallback(new AsyncRecord.CompleteCallback(this.AsyncCompleteCallback));
 }
예제 #4
0
        public override Present Realize(string refCredit)
        {
            Present present = this.asyncFuture.Realize(refCredit);

            if (present is AsyncRef)
            {
                AsyncRef asyncRef = (AsyncRef)present;
                asyncRef.AddCallback(new AsyncRecord.CompleteCallback(this.PresentReadyCallback));
                asyncRef.SetInterest(this.interestValue);
                AsyncRef asyncRef2 = (AsyncRef)asyncRef.Duplicate(refCredit + "2");
                new PersistentInterest(asyncRef);
                this.asyncReadyEvent.WaitOne();
                return(asyncRef2.present);
            }
            return(present);
        }