예제 #1
0
        // Only present for testing.
        internal int GetPoolSize(SpannerClient spannerClient, string project, string spannerInstance, string spannerDatabase)
        {
            GaxPreconditions.CheckNotNull(spannerClient, nameof(spannerClient));
            GaxPreconditions.CheckNotNull(project, nameof(project));
            GaxPreconditions.CheckNotNull(spannerInstance, nameof(spannerInstance));
            GaxPreconditions.CheckNotNull(spannerDatabase, nameof(spannerDatabase));
            var             sessionPoolKey = new SessionPoolKey(spannerClient, project, spannerInstance, spannerDatabase);
            SessionPoolImpl targetPool     = _poolByClientAndDatabase.GetOrAdd(sessionPoolKey, key => new SessionPoolImpl(key, Options));

            return(targetPool.GetPoolSize());
        }
예제 #2
0
        internal int GetPoolSize(
            SpannerClient spannerClient,
            string project,
            string spannerInstance,
            string spannerDatabase)
        {
            project.ThrowIfNullOrEmpty(nameof(project));
            spannerInstance.ThrowIfNullOrEmpty(nameof(spannerInstance));
            spannerDatabase.ThrowIfNullOrEmpty(nameof(spannerDatabase));
            var sessionPoolKey = new SessionPoolKey(spannerClient,
                                                    project,
                                                    spannerInstance,
                                                    spannerDatabase);
            SessionPoolImpl targetPool = _poolByClientAndDatabase.GetOrAdd(sessionPoolKey,
                                                                           key => new SessionPoolImpl(key, Options));

            return(targetPool.GetPoolSize());
        }