/// <summary> /// Acquire a new Client object from the pool. /// </summary> /// <returns></returns> public static PooledClient Acquire() { if (poolSize < 1) throw new SDBPException(Status.SDBP_API_ERROR, "Uninitialized static class"); PooledClient client; lock (clients) { if (clients.Count > 0) { client = clients[0]; clients.RemoveAt(0); } else { client = new PooledClient(controllers); } } return client; }
internal static void Release(PooledClient client) { if (poolSize < 1) throw new SDBPException(Status.SDBP_API_ERROR, "Uninitialized static class"); lock (clients) { if (clients.Count < poolSize) clients.Add(client); } }