/// <nodoc /> public ReloadingClient(IIpcLogger logger, Func <T> clientConstructor, IEnumerable <TimeSpan> retryIntervals = null, IEnumerable <Type> nonRetryableExceptions = null) { Contract.Assert(logger != null); Contract.Assert(clientConstructor != null); Contract.Assert(nonRetryableExceptions == null || nonRetryableExceptions.All(e => e.IsSubclassOf(typeof(Exception)))); m_logger = logger; Reloader = new Reloader <T>(clientConstructor, destructor: client => client.Dispose()); m_retryIntervals = retryIntervals ?? s_defaultRetryIntervals; m_nonRetryableExceptions = nonRetryableExceptions == null ? new HashSet <Type>() : new HashSet <Type>(nonRetryableExceptions); }
/// <summary> /// Constructor. /// </summary> /// <param name="logger">Logger.</param> /// <param name="clientConstructor">Target drop service client.</param> /// <param name="retryIntervals">How many times to retry and how much to wait between retries.</param> public ReloadingDropServiceClient(ILogger logger, Func <IDropServiceClient> clientConstructor, IEnumerable <TimeSpan> retryIntervals = null) { m_logger = logger; m_reloader = new Reloader <IDropServiceClient>(clientConstructor, destructor: client => client.Dispose()); m_retryIntervals = retryIntervals ?? s_defaultRetryIntervals; }