public void Dispose() { try { if (_receiveDisruptor != null) { _receiveDisruptor.Dispose(); } if (_publishDisruptor != null) { _publishDisruptor.Dispose(); } if (_endpoint != null) { _endpoint.Dispose(); } } catch (Exception ex) { LogTo.Error(ex.ToString()); } finally { _receiveDisruptor = null; _publishDisruptor = null; _endpoint = null; } }
public static Dictionary <string, decimal> DicMessageCount = new Dictionary <string, decimal>(); //Luu thong tin tong so msg trong 5 phut #endregion public Endpoint(IProcess processor, int maxSize, int inBufferSize, int outBufferSize, bool isWorker = false, bool isBStarMode = false, WorkerType?workerType = null, bool enableLoader = false) { _processor = processor; //ghi nhan hoat dong cua disruptor _receiveDisruptor = new ReceiveDisruptor(_processor, inBufferSize, isWorker, isBStarMode, workerType); //tao rieng network cho tung loai endpoint _endpoint = new NetworkClient(_receiveDisruptor); DataLoader loader = null; if (enableLoader) { loader = new DataLoader(_processor); } _publishDisruptor = new PublishDisruptor(_endpoint, maxSize, outBufferSize, loader); }