Beispiel #1
0
 /// <summary>
 /// Disposes the write client.
 /// </summary>
 /// <param name="client">The client.</param>
 public void DisposeWriteClient(RedisNativeClient client)
 {
     lock (writeClients)
     {
         client.Active = false;
         Monitor.PulseAll(writeClients);
     }
 }
Beispiel #2
0
 /// <summary>
 /// Disposes the read only client.
 /// </summary>
 /// <param name="client">The client.</param>
 public void DisposeReadOnlyClient(RedisNativeClient client)
 {
     lock (readClients)
     {
         client.Active = false;
         Monitor.PulseAll(readClients);
     }
 }
Beispiel #3
0
        public void DisposeClient(RedisNativeClient client)
        {
            lock (readClients)
            {
                for (var i = 0; i < readClients.Length; i++)
                {
                    var readClient = readClients[i];
                    if (client != readClient)
                    {
                        continue;
                    }
                    client.Active = false;
                    Monitor.PulseAll(readClients);
                    return;
                }
            }

            lock (writeClients)
            {
                for (var i = 0; i < writeClients.Length; i++)
                {
                    var writeClient = writeClients[i];
                    if (client != writeClient)
                    {
                        continue;
                    }
                    client.Active = false;
                    Monitor.PulseAll(writeClients);
                    return;
                }
            }

            //Console.WriteLine("Couldn't find {0} client with Id: {1}, readclients: {2}, writeclients: {3}",
            //    client.IsDisposed ? "Disposed" : "Undisposed",
            //    client.Id,
            //    string.Join(", ", readClients.ToList().ConvertAll(x => x != null ? x.Id.ToString() : "").ToArray()),
            //    string.Join(", ", writeClients.ToList().ConvertAll(x => x != null ? x.Id.ToString() : "").ToArray()));

            if (client.IsDisposed)
            {
                return;
            }

            throw new NotSupportedException("Cannot add unknown client back to the pool");
        }
Beispiel #4
0
        public void DisposeClient(RedisNativeClient client)
        {
            lock (readClients)
            {
                for (var i = 0; i < readClients.Length; i++)
                {
                    var readClient = readClients[i];
                    if (client != readClient)
                    {
                        continue;
                    }
                    client.Active = false;
                    Monitor.PulseAll(readClients);
                    return;
                }
            }

            lock (writeClients)
            {
                for (var i = 0; i < writeClients.Length; i++)
                {
                    var writeClient = writeClients[i];
                    if (client != writeClient)
                    {
                        continue;
                    }
                    client.Active = false;
                    Monitor.PulseAll(writeClients);
                    return;
                }
            }

            //Client not found in any pool, pulse both pools.
            lock (readClients)
                Monitor.PulseAll(readClients);
            lock (writeClients)
                Monitor.PulseAll(writeClients);
        }
		public RedisPipelineCommand(RedisNativeClient client)
		{
			this.client = client;
		}
		public void DisposeClient(RedisNativeClient client)
		{
			lock (readClients)
			{
				for (var i = 0; i < readClients.Length; i++)
				{
					var readClient = readClients[i];
					if (client != readClient) continue;
					client.Active = false;
					Monitor.PulseAll(readClients);
					return;
				}
			}

			lock (writeClients)
			{
				for (var i = 0; i < writeClients.Length; i++)
				{
					var writeClient = writeClients[i];
					if (client != writeClient) continue;
					client.Active = false;
					Monitor.PulseAll(writeClients);
					return;
				}
			}
			
			//Console.WriteLine("Couldn't find {0} client with Id: {1}, readclients: {2}, writeclients: {3}",
			//    client.IsDisposed ? "Disposed" : "Undisposed",
			//    client.Id,
			//    string.Join(", ", readClients.ToList().ConvertAll(x => x != null ? x.Id.ToString() : "").ToArray()),
			//    string.Join(", ", writeClients.ToList().ConvertAll(x => x != null ? x.Id.ToString() : "").ToArray()));

			if (client.IsDisposed) return;

			throw new NotSupportedException("Cannot add unknown client back to the pool");
		}
 public RedisPipelineCommand(RedisNativeClient client)
 {
     this.client = client;
 }
 /// <summary>
 /// Disposes the read only client.
 /// </summary>
 /// <param name="client">The client.</param>
 public void DisposeReadOnlyClient(RedisNativeClient client)
 {
     lock (readClients)
     {
         client.Active = false;
         Monitor.PulseAll(readClients);
     }
 }
 public ExpectDoubleCommand(RedisNativeClient client) : base(client)
 {
 }
 public ExpectSuccessCommand(RedisNativeClient client) : base(client)
 {
 }
 public ExpectMultiDataCommand(RedisNativeClient client) : base(client)
 {
 }
Beispiel #12
0
 public ExpectMultiDataCommand(RedisNativeClient client) : base(client)
 {
 }
Beispiel #13
0
 public ExpectWordCommand(RedisNativeClient client, string word)
     : base(client)
 {
     word_ = word;
 }
Beispiel #14
0
 public ExpectStringCommand(RedisNativeClient client) : base(client)
 {
 }
 /// <summary>
 /// Disposes the write client.
 /// </summary>
 /// <param name="client">The client.</param>
 public void DisposeWriteClient(RedisNativeClient client)
 {
     lock (writeClients)
     {
         client.Active = false;
         Monitor.PulseAll(writeClients);
     }
 }
Beispiel #16
0
 public PipelineCommand(RedisNativeClient client)
 {
     client_ = client;
 }
 public ExpectWordCommand(RedisNativeClient client, string word)
     : base(client)
 {
     word_ = word;
 }
Beispiel #18
0
 public ExpectSuccessCommand(RedisNativeClient client) : base(client)
 {
 }
 public PipelineCommand(RedisNativeClient client)
 {
     client_ = client;
 }
Beispiel #20
0
 public ExpectIntCommand(RedisNativeClient client) : base(client)
 {
 }
 public ExpectIntCommand(RedisNativeClient client) : base(client)
 {
 }
Beispiel #22
0
 public ExpectDoubleCommand(RedisNativeClient client) : base(client)
 {
 }
 public ExpectStringCommand(RedisNativeClient client) : base(client)
 {
 }
        public void DisposeClient(RedisNativeClient client)
        {
            lock (readClients)
            {
                for (var i = 0; i < readClients.Length; i++)
                {
                    var readClient = readClients[i];
                    if (client != readClient) continue;
                    client.Active = false;
                    Monitor.PulseAll(readClients);
                    return;
                }
            }

            lock (writeClients)
            {
                for (var i = 0; i < writeClients.Length; i++)
                {
                    var writeClient = writeClients[i];
                    if (client != writeClient) continue;
                    client.Active = false;
                    Monitor.PulseAll(writeClients);
                    return;
                }
            }

            //Client not found in any pool, pulse both pools.
            lock (readClients)
                Monitor.PulseAll(readClients);
            lock (writeClients)
                Monitor.PulseAll(writeClients);
        }