示例#1
0
 public void Increase()
 {
     lock (locker)
     {
         this.state = this.state.Next();
         this.state.PerformStateOperation();
     }
 }
示例#2
0
        public LimitCounter(int nrOfRequests, TimeSpan allowedTime, TimeSpan suspendFor)
        {
            this.nrOfRequests = nrOfRequests;
            this.allowedTime  = allowedTime;
            this.suspendedFor = suspendFor;

            this.state = (this as ILimitCounterStateFactory).GetNewValidState();
        }