Ejemplo n.º 1
0
        public static void Class_Init(TestContext ctx)
        {
            _disruptor = NewDisruptor();

            _disruptor.HandleEventsWith(new SummingEventHandler());

            _ringbuffer = _disruptor.Start();

            _producer = new EventProducerWithTranslator(_ringbuffer);
        }
Ejemplo n.º 2
0
        public static void Class_Init(TestContext ctx)
        {
            _disruptor = NewDisruptor();

            _disruptor
            .HandleEventsWith(new MockLogToDiskEventHandler())
            .Then(new MockBusinessLogicEventHandler());

            _ringbuffer = _disruptor.Start();

            _producer = new EventProducerWithTranslator(_ringbuffer);
        }
        public static void Class_Init(TestContext ctx)
        {
            _disruptor = NewDisruptor();

            _disruptor.HandleEventsWith(
                new ThreadSleepRandomEventHandler(),
                new ThreadSleepConstantEventHandler());

            _ringbuffer = _disruptor.Start();

            _producer = new EventProducerWithTranslator(_ringbuffer);
        }
Ejemplo n.º 4
0
        public void Sample_03_SR_SP_Tx()
        {
            var disruptor = NewDisruptor();

            disruptor.HandleEventsWith(new SummingEventHandler());

            try
            {
                var ringbuffer = disruptor.Start();

                var producer = new EventProducerWithTranslator(ringbuffer);

                for (ulong ix = 0; ix < MAX_ITERATIONS; ix++)
                {
                    producer.OnNewData(1);
                }
            }
            finally
            {
                disruptor.Shutdown();
            }
        }