public void Increase() { lock (locker) { this.state = this.state.Next(); this.state.PerformStateOperation(); } }
public LimitCounter(int nrOfRequests, TimeSpan allowedTime, TimeSpan suspendFor) { this.nrOfRequests = nrOfRequests; this.allowedTime = allowedTime; this.suspendedFor = suspendFor; this.state = (this as ILimitCounterStateFactory).GetNewValidState(); }