public object Clone() { BrokenConnectionInfo clone = new BrokenConnectionInfo(); clone.BrokenAddress = BrokenAddress; clone.SessionType = SessionType; return(clone); }
public void UnregisterListener(BrokenConnectionInfo entryKey) { if (_brokenConnections != null) { IList <BrokenConnectionEntry> brokenConnList = _brokenConnections.ToList(); foreach (var entry in brokenConnList) { if (entry.ConnectionInfo.BrokenAddress.Equals(entryKey.BrokenAddress)) { UnregisterListener(entry); } } } }
public void RegisterListener(BrokenConnectionInfo entryKey, IConnectionRestorationListener listener, string shardName) { LoggerManager.Instance.SetThreadContext(new LoggerContext() { ShardName = shardName != null ? shardName : "", DatabaseName = "" }); BrokenConnectionEntry entry = new BrokenConnectionEntry(); entry.CRetryInfo = new BrokenConnectionEntry.RetryInfo(); entry.CRetryInfo.LastRetryTimestamp = DateTime.Now; entry.CRetryInfo.RetryInterval = _basicRetryInterval; entry.ConnectionRestorationListener = listener; if (_context != null) { entry.Channel = new DualChannel(entryKey.BrokenAddress.IpAddress.ToString(), entryKey.BrokenAddress.Port, _context.LocalAddress.IpAddress.ToString(), entryKey.SessionType, new TraceProvider(), new ShardChannelFormatter()); } entry.ConnectionInfo = entryKey; if (_brokenConnections == null) { _brokenConnections = new List <BrokenConnectionEntry>(); this.Start(); } lock (_mutex) { if (!_brokenConnections.Contains(entry)) { if (LoggerManager.Instance.ShardLogger != null && LoggerManager.Instance.ShardLogger.IsInfoEnabled) { LoggerManager.Instance.ShardLogger.Info("ConnRestorationMgr.RegisterListener()", entry.ToString()); } _brokenConnections.Add(entry); } if (_brokenConnections.Count == 1 && IsPaused) { this.Resume(); } } }
public bool Equals(BrokenConnectionInfo obj) { return(this.BrokenAddress == obj.BrokenAddress && this.SessionType == obj.SessionType); }