Exemplo n.º 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);
     }
 }
Exemplo n.º 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);
     }
 }
Exemplo n.º 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");
        }
Exemplo n.º 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);
        }
Exemplo n.º 5
0
		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)
 {
 }
Exemplo n.º 12
0
 public ExpectMultiDataCommand(RedisNativeClient client) : base(client)
 {
 }
Exemplo n.º 13
0
 public ExpectWordCommand(RedisNativeClient client, string word)
     : base(client)
 {
     word_ = word;
 }
Exemplo n.º 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);
     }
 }
Exemplo n.º 16
0
 public PipelineCommand(RedisNativeClient client)
 {
     client_ = client;
 }
 public ExpectWordCommand(RedisNativeClient client, string word)
     : base(client)
 {
     word_ = word;
 }
Exemplo n.º 18
0
 public ExpectSuccessCommand(RedisNativeClient client) : base(client)
 {
 }
 public PipelineCommand(RedisNativeClient client)
 {
     client_ = client;
 }
Exemplo n.º 20
0
 public ExpectIntCommand(RedisNativeClient client) : base(client)
 {
 }
 public ExpectIntCommand(RedisNativeClient client) : base(client)
 {
 }
Exemplo n.º 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);
        }