public PriorityPersistQueue(IQProperties qp) : base(qp.QueueName) { DbLiteSettings settings = new DbLiteSettings() { Name = qp.QueueName, CommitMode = (CommitMode)(int)qp.CommitMode, DbPath = AgentManager.Settings.QueuesPath }; //settings.SetFast(); m_db = new PersistentBinary <IQueueItem>(settings); //m_db = new PersistentDictionary(settings); m_db.BeginLoading += M_db_BeginLoading; m_db.LoadCompleted += M_db_LoadCompleted; m_db.ErrorOcurred += M_db_ErrorOcurred; m_db.ClearCompleted += M_db_ClearCompleted; //m_db.ItemChanged += M_db_ItemChanged; m_db.ItemLoaded = (item) => { this.ReEnqueue(item); }; if (qp.ReloadOnStart) { Logger.Info("PriorityPersistQueue will load items to : {0}", qp.QueueName); } else { Logger.Info("PriorityPersistQueue will clear all items from : {0}", qp.QueueName); } m_db.ReloadOrClearPersist(qp.ReloadOnStart); }
public PriorityComplexQueue(IQProperties qp) : base(qp.QueueName) { int numProcs = Environment.ProcessorCount; int concurrencyLevel = numProcs * 2; int initialCapacity = 101; QueueList = new ConcurrentDictionary <Ptr, IQueueItem>(concurrencyLevel, initialCapacity); CommitMode = (CommitMode)(int)qp.CommitMode; CoverMode = qp.Mode; if (CoverMode == CoverMode.Persistent) { DbLiteSettings settings = new DbLiteSettings() { Name = qp.QueueName, CommitMode = (CommitMode)(int)qp.CommitMode, DbPath = AgentManager.Settings.QueuesPath }; //settings.SetFast(); m_db = new PersistentBinary <IQueueItem>(settings); //m_db = new PersistentDictionary(settings); m_db.BeginLoading += M_db_BeginLoading; m_db.LoadCompleted += M_db_LoadCompleted; m_db.ErrorOcurred += M_db_ErrorOcurred; m_db.ClearCompleted += M_db_ClearCompleted; //m_db.ItemChanged += M_db_ItemChanged; m_db.ItemLoaded = (item) => { this.ReEnqueue(item); }; if (qp.ReloadOnStart) { Logger.Info("PriorityComplexQueue will load items to : {0}", qp.QueueName); } else { Logger.Info("PriorityComplexQueue will clear all items from : {0}", qp.QueueName); } m_db.ReloadOrClearPersist(qp.ReloadOnStart); } }