public override void Complete() { if (IsCompleted()) { // complete() was called more than once IMessage evt0 = new DefaultEvent("CAT", "BadInstrument") { Status = "TransactionAlreadyCompleted" }; evt0.Complete(); AddChild(evt0); } else { _mDurationInMicro = MilliSecondTimer.CurrentTimeMicros() - TimestampInMicros; SetCompleted(true); if (_endCallBack != null) { _endCallBack(this); } } }
protected AbstractMessage(string type, string name, IMessageManager messageManager = null) { _type = type; _name = name; _messageManager = messageManager; TimestampInMicros = MilliSecondTimer.CurrentTimeMicros(); }
public override void Complete() { try { if (IsCompleted()) { // complete() was called more than once IMessage evt0 = new DefaultEvent("cat", "BadInstrument") { Status = "TransactionAlreadyCompleted" }; evt0.Complete(); AddChild(evt0); } else { _mDurationInMicro = MilliSecondTimer.CurrentTimeMicros() - TimestampInMicros; SetCompleted(true); if (_mManager != null) { _mManager.End(this); } } } catch (Exception ex) { Cat.lastException = ex; } }
private void Log(string severity, string pattern, params object[] args) { string timestamp = new DateTime(MilliSecondTimer.CurrentTimeMicros() * 10L).ToString("yyyy-MM-dd HH:mm:ss.fff"); string message = string.Format(pattern, args); string line = "[" + timestamp + "] [" + severity + "] " + message; if (_mWriter != null) { _mWriter.WriteLine(line); _mWriter.Flush(); } else { Console.WriteLine(line); } }
private bool ShouldMerge(BlockingThreadSafeQueue <IMessageTree> trees) { IMessageTree tree; trees.TryPeek(out tree, true); if (tree != null) { long firstTime = tree.Message.Timestamp; // 30 sec const int maxDuration = 1000 * 30; if (MilliSecondTimer.CurrentTimeMicros() / 1000 - firstTime > maxDuration || trees.Count >= MAX_ATOMIC_MESSAGES || trees.Count >= _mClientConfig.MaxQueueSize || trees.EstimatedByteSize >= _mClientConfig.MaxQueueByteSize) { return(true); } } return(false); }
protected AbstractMessage(String type, String name) { _mType = type; _mName = name; TimestampInMicros = MilliSecondTimer.CurrentTimeMicros(); }