public BatchManager(BeginBatchedDelegate <TItem> batchedBeginOperation, EndBatchedDelegate batchedEndOperation, CalculateBatchSizeDelegate <TItem> calculateBatchSize, OnRetryDelegate <TItem> onRetryOperation, TransactionStateChangedDelegate transactionStateChanged, TransactionCompletedEventHandler transactionCompletedEventHandler, long flushThreshold, long maximumBatchSize, int batchOverheadSize) { this.StartBatchOperation = new BatchManager <TItem> .StartBatchOperationDelegate(BatchManager <TItem> .PerformFlushAsyncResult.StartBatchOperation); this.BatchedBegin = batchedBeginOperation; this.BatchedEnd = batchedEndOperation; this.CalculateBatchSize = calculateBatchSize; this.OnRetry = onRetryOperation; this.OnTransactionStateChanged = transactionStateChanged; this.transactionCompletedEventHandler = transactionCompletedEventHandler; this.batchedResults = new Queue <BatchManager <TItem> .BatchedObjectsAsyncResult>(); this.transactionalBatchResults = new Dictionary <string, Queue <BatchManager <TItem> .BatchedObjectsAsyncResult> >(); this.flushTimer = new IOThreadTimer(BatchManager <TItem> .flushTimerCallback, this, false); this.flushThreshold = flushThreshold; this.maximumBatchSize = maximumBatchSize; this.pendingBatchSize = batchOverheadSize; this.batchOverheadSize = batchOverheadSize; this.syncLock = new object(); this.syncTransactionLock = new object(); }