Пример #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void shouldBeAbleToProgressUnderStressfulProcessorChanges(int orderingGuarantees) throws Exception
        private void ShouldBeAbleToProgressUnderStressfulProcessorChanges(int orderingGuarantees)
        {
            // given
            int            batches    = 100;
            int            processors = Runtime.Runtime.availableProcessors() * 10;
            Configuration  config     = new Configuration_OverriddenAnonymousInnerClass(this, Configuration.DEFAULT, processors);
            Stage          stage      = new StressStage(config, orderingGuarantees, batches);
            StageExecution execution  = stage.Execute();
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: java.util.List<Step<?>> steps = asList(execution.steps());
            IList <Step <object> > steps = new IList <Step <object> > {
                execution.Steps()
            };

            steps[1].Processors(processors / 3);

            // when
            ThreadLocalRandom random = ThreadLocalRandom.current();

            while (execution.StillExecuting())
            {
                steps[2].Processors(random.Next(-2, 5));
                Thread.Sleep(1);
            }
            execution.AssertHealthy();

            // then
            assertEquals(batches, steps[steps.Count - 1].Stats().stat(Keys.done_batches).asLong());
        }
Пример #2
0
 public ForkedProcessorStepAnonymousInnerClass3(StressStage outerInstance, [email protected] control, Configuration config) : base(control, "Subject", config)
 {
     this.outerInstance = outerInstance;
 }
Пример #3
0
 public PullingProducerStepAnonymousInnerClass(StressStage outerInstance, [email protected] control, Configuration config, int batches) : base(control, config)
 {
     this.outerInstance = outerInstance;
     this._batches      = batches;
 }