public void Add(IConnectOptions connectOptions, RedisConnectionFactory factory) { lock (_synch) { Interlocked.Increment(ref _count); IConnectOptions oldConnectOptions = null; if (_keys.TryGetValue(connectOptions.TagName, out oldConnectOptions)) { RedisConnectionFactory oldFactory = null; //但是属性已发生变更 if (connectOptions.CompareTo(oldConnectOptions) == 0) { _keys.Remove(connectOptions.TagName); _queue.TryDequeue(out oldFactory); //重新入队 _keys.Add(connectOptions.TagName, connectOptions); _queue.Enqueue(factory); } } else { _keys.Add(connectOptions.TagName, connectOptions); _queue.Enqueue(factory); } Interlocked.Decrement(ref _count); } }
public void Add(IConnectOptions key, RabbitConnectionFactory factory) { rwLock.EnterWriteLock(); IConnectOptions connectOptions = null; try { if (_keys.TryGetValue(key.TagName, out connectOptions)) { //但是属性已发生变更 if (connectOptions.CompareTo(key) == 0) { RabbitConnectionFactory oldFactory = null; _keys.Remove(key.TagName); _queue.TryDequeue(out oldFactory); //重新入队 _keys.Add(key.TagName, key); _queue.Enqueue(factory); } } else { _keys.Add(key.TagName, key); _queue.Enqueue(factory); } } finally { rwLock.ExitWriteLock(); } }
public void Connect_UnitTest() { IConnectOptions connectOptions = default(IConnectOptions); ExecuteMethod( () => { return((IIServerDataProvider)GetInstance()); }, instance => { connectOptions = ConnectOptionsWrapper_UnitTests.GetInstance(); Connect_PreCondition(instance, ref connectOptions); }, instance => { instance.Connect(connectOptions); }, instance => { Connect_PostValidate(instance, connectOptions); }); }
partial void Connect_PreCondition(IIServerDataProvider instance, ref IConnectOptions connectOptions);
partial void Connect_PostValidate(IIServerDataProvider instance, IConnectOptions connectOptions);
/// <summary> /// Connects the specified connect options. /// </summary> /// <param name="connectOptions">The connect options.</param> /// <exception cref="DynCon.OSI.Core.Helpers.ToBeImplementedException"></exception> void IIServerDataProvider.Connect(IConnectOptions connectOptions) { throw new ToBeImplementedException(); }
/// <summary> /// Connects the specified connect options. /// </summary> /// <param name="connectOptions">The connect options.</param> /// <exception cref="ToBeImplementedException"></exception> void ITfsConnection.Connect(IConnectOptions connectOptions) { throw new ToBeImplementedException(); }
/// <summary> /// Gets the instance. /// </summary> /// <param name="src">The source.</param> /// <returns>ConnectOptions.</returns> public static ConnectOptions GetInstance(IConnectOptions src) { return(default(ConnectOptions)); }