v7.3.2018.0614   重构高性能资源池,减少GC压力,增加线程池,让异步任务得到平等竞争CPU的机会
大石头 authored at 2018-06-14 17:56:44
980.00 B
X
using System;
using System.Collections.Generic;

namespace NewLife.Queue.Broker
{
    public class BatchMessageLogRecord
    {
        private readonly IEnumerable<MessageLogRecord> _records;
        private readonly Action<BatchMessageLogRecord, object> _callback;
        private readonly object _parameter;

        public IEnumerable<MessageLogRecord> Records
        {
            get { return _records; }
        }
        public Action<BatchMessageLogRecord, object> Callback
        {
            get { return _callback; }
        }

        public BatchMessageLogRecord(IEnumerable<MessageLogRecord> records, Action<BatchMessageLogRecord, object> callback, object parameter)
        {
            _records = records;
            _callback = callback;
            _parameter = parameter;
        }

        public void OnPersisted()
        {
            if (_callback != null)
            {
                _callback(this, _parameter);
            }
        }
    }
}