public virtual IDisruptor <TransformationItem> CreateTransformationDisruptor(IRepository repository, BootstrapInfo info)
        {
            var serializationHandler  = new SerializationHandler(this.CreateInboundSerializer(), this.transientTypes);
            var systemSnapshotTracker = new SystemSnapshotTracker(info.JournaledSequence, this.snapshotFrequency, this.snapshotRing, repository);
            var transformationHandler = this.CreateTransformationHandler(repository, info.JournaledSequence, systemSnapshotTracker);

            var disruptor = CreateMultithreadedDisruptor <TransformationItem>(new SleepingWaitStrategy(), 1024 * 32);

            disruptor
            .HandleEventsWith(serializationHandler)
            .Then(transformationHandler)
            .Then(new ClearItemHandler());

            return(new DisruptorBase <TransformationItem>(disruptor));
        }
        public virtual IDisruptor <TransformationItem> CreateStartupTransformationDisruptor(IRepository repository, BootstrapInfo info, Action <bool> complete)
        {
            var countdown = info.JournaledSequence - info.SnapshotSequence;

            if (countdown == 0)
            {
                return(null);
            }

            var serializerCount = 1;

            if (countdown > 1024 * 32)
            {
                serializerCount++;
            }
            if (countdown > 1024 * 512)
            {
                serializerCount++;
            }
            if (countdown > 1024 * 1024 * 4)
            {
                serializerCount++;
            }

            var replayTransientTypes = new HashSet <Type>();
            var serializers          = new SerializationHandler[serializerCount];

            for (var i = 0; i < serializerCount; i++)
            {
                serializers[i] = new SerializationHandler(this.CreateInboundSerializer(), replayTransientTypes, serializerCount, i);
            }
            var transformationHandler = this.CreateTransformationHandler(repository, info.JournaledSequence);

            var slots     = ComputeDisruptorSize(countdown);
            var disruptor = CreateSingleThreadedDisruptor <TransformationItem>(new SleepingWaitStrategy(), slots);

            disruptor.HandleEventsWith(serializers.Cast <IEventHandler <TransformationItem> >().ToArray())
            .Then(transformationHandler)
            .Then(new CountdownHandler(countdown, complete))
            .Then(new ClearItemHandler());

            return(new DisruptorBase <TransformationItem>(disruptor));
        }