Example #1
0
 protected AbstractBatchedWorkItem(
     string id, WorkBatch batch, CancellationToken cancellationToken)
 {
     Id    = id;
     Batch = batch;
     _cancellationToken = cancellationToken;
 }
Example #2
0
        public IWorkBatch Create(int workBatchSize, IWorkBatch yourBatch, IEnumerable preComputedResults = null,
                                 bool startup = false)
        {
            var batch = new WorkBatch(workBatchSize, yourBatch, preComputedResults);

            if (!startup)
            {
                return(batch);
            }

            if (_startupCreated)
            {
                throw new ApplicationException("You can only have one startup batch");
            }

            _startupCreated = true;

            return(new StartupWorkBatch(batch, _startupBarrier));
        }