internal static void Reset() { CommandComponentsCollection.Clear(); ExecutionSemaphores.Clear(); FallbackExecutionSemaphores.Clear(); CommandCount.GetAndSet(0); CustomBadRequestExceptionChecker.BadRequestExceptionCheckers.Clear(); }
public int GetAndSet(int newValue) { if (newValue < 0) { throw new ArgumentException("new value " + newValue + " < 0"); } return(i.GetAndSet(newValue)); }
public void TestThatAFailureIsNotComposedWithAndThenTo() { var currentValue = new AtomicInteger(0); Failure.Of <Exception, int>(RandomException()) .AndThenTo(val => Success.Of <Exception, int>(currentValue.GetAndSet(val))); Assert.Equal(0, currentValue.Get()); }
private void DoUpdates() { int cnt = pendingUpdates.GetAndSet(0); if (0 < cnt) { pm.Update(cnt); } }
public T Choose(T[] items) { if (items == null || items.Length == 0) { return(default(T)); } int counterValue = counter.GetAndIncrement(); if (counterValue > MaxValue) { counter.GetAndSet(0); } int index = counterValue % items.Length; return(items[index]); }
public void IncrementConcurrentExecutionCount() { var operationCount = concurrentExecutionCount.IncrementAndGet(); if (operationCount > maxConcurrentExecutionCount.Value) { maxConcurrentExecutionCount.GetAndSet(operationCount); } }
/// <summary> /// 服务并发量自增 /// </summary> internal void IncrementConcurrentExecutionCount() { var serviceCount = serviceConcurrentExecutionCount.IncrementAndGet(); if (serviceCount > serviceMaxConcurrentExecutionCount.Value) { serviceMaxConcurrentExecutionCount.GetAndSet(serviceCount); } }
/// <summary> /// notify the input stream that there is no more data /// </summary> protected void noMoreData() { expectMoreData.GetAndSet(0); }
public void can_get_and_set() { _num.SetValue(32); _num.GetAndSet(64).Should().Be(32); _num.GetValue().Should().Be(64); }