Skip to content

Commit 00d67cd

Browse files
committed
CSHARP-1117: Rename MaxPoolSize to MaxChunkCount in BsonChunkPool.
1 parent f7ee6f2 commit 00d67cd

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

src/MongoDB.Bson.Tests/IO/BsonChunkPoolTests.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ public void ChunkSize_get_should_return_expected_result()
4242
[Test]
4343
public void constructor_should_initialize_subject()
4444
{
45-
var maxPoolSize = 1;
45+
var maxChunkCount = 1;
4646
var chunkSize = 16;
4747

48-
var subject = new BsonChunkPool(maxPoolSize, chunkSize);
48+
var subject = new BsonChunkPool(maxChunkCount, chunkSize);
4949

5050
var reflector = new Reflector(subject);
51-
subject.MaxPoolSize.Should().Be(maxPoolSize);
51+
subject.MaxChunkCount.Should().Be(maxChunkCount);
5252
subject.ChunkSize.Should().Be(chunkSize);
5353
reflector._disposed.Should().BeFalse();
5454
}
@@ -64,11 +64,11 @@ public void constructor_should_throw_chunkSize_is_less_than_zero(
6464
}
6565

6666
[Test]
67-
public void constructor_should_throw_whenMaxPoolSize_is_less_than_zero()
67+
public void constructor_should_throw_when_MaxChunkCount_is_less_than_zero()
6868
{
6969
Action action = () => new BsonChunkPool(-1, 16);
7070

71-
action.ShouldThrow<ArgumentOutOfRangeException>().And.ParamName.Should().Be("maxPoolSize");
71+
action.ShouldThrow<ArgumentOutOfRangeException>().And.ParamName.Should().Be("maxChunkCount");
7272
}
7373

7474
[Test]
@@ -77,7 +77,7 @@ public void Default_get_should_return_expected_result()
7777
var result = BsonChunkPool.Default;
7878

7979
result.ChunkSize.Should().Be(64 * 1024);
80-
result.MaxPoolSize.Should().Be(8192);
80+
result.MaxChunkCount.Should().Be(8192);
8181
}
8282

8383
[Test]
@@ -166,11 +166,11 @@ public void GetChunk_should_throw_when_subject_is_disposed()
166166
}
167167

168168
[Test]
169-
public void MaxPoolSize_get_should_return_expected_result()
169+
public void MaxChunkCount_get_should_return_expected_result()
170170
{
171171
var subject = new BsonChunkPool(1, 16);
172172

173-
var result = subject.MaxPoolSize;
173+
var result = subject.MaxChunkCount;
174174

175175
result.Should().Be(1);
176176
}
@@ -254,7 +254,7 @@ public void Dispose_should_return_chunk_to_the_pool()
254254

255255
subject.Dispose();
256256

257-
pool.PoolSize.Should().Be(1);
257+
pool.ChunkCount.Should().Be(1);
258258
}
259259

260260
[Test]
@@ -284,11 +284,11 @@ public void Dispose_should_return_chunk_to_the_pool_after_all_handles_have_been_
284284

285285
foreach (var handle in handles)
286286
{
287-
pool.PoolSize.Should().Be(0);
287+
pool.ChunkCount.Should().Be(0);
288288
handle.Dispose();
289289
}
290290

291-
pool.PoolSize.Should().Be(1);
291+
pool.ChunkCount.Should().Be(1);
292292
}
293293

294294
[Test]

src/MongoDB.Bson/IO/BsonChunkPool.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,26 +54,26 @@ public static BsonChunkPool Default
5454
private readonly int _chunkSize;
5555
private bool _disposed;
5656
private readonly object _lock = new object();
57-
private readonly int _maxPoolSize;
57+
private readonly int _maxChunkCount;
5858

5959
// constructors
6060
/// <summary>
6161
/// Initializes a new instance of the <see cref="BsonChunkPool"/> class.
6262
/// </summary>
63-
/// <param name="maxPoolSize">The maximum number of chunks to keep in the pool.</param>
63+
/// <param name="maxChunkCount">The maximum number of chunks to keep in the pool.</param>
6464
/// <param name="chunkSize">The size of each chunk.</param>
65-
public BsonChunkPool(int maxPoolSize, int chunkSize)
65+
public BsonChunkPool(int maxChunkCount, int chunkSize)
6666
{
67-
if (maxPoolSize < 0)
67+
if (maxChunkCount < 0)
6868
{
69-
throw new ArgumentOutOfRangeException("maxPoolSize");
69+
throw new ArgumentOutOfRangeException("maxChunkCount");
7070
}
7171
if (chunkSize <= 0)
7272
{
7373
throw new ArgumentOutOfRangeException("chunkSize");
7474
}
7575

76-
_maxPoolSize = maxPoolSize;
76+
_maxChunkCount = maxChunkCount;
7777
_chunkSize = chunkSize;
7878
}
7979

@@ -95,9 +95,9 @@ public int ChunkSize
9595
/// <value>
9696
/// The maximum size of the pool.
9797
/// </value>
98-
public int MaxPoolSize
98+
public int MaxChunkCount
9999
{
100-
get { return _maxPoolSize; }
100+
get { return _maxChunkCount; }
101101
}
102102

103103
/// <summary>
@@ -106,7 +106,7 @@ public int MaxPoolSize
106106
/// <value>
107107
/// The size of the pool.
108108
/// </value>
109-
public int PoolSize
109+
public int ChunkCount
110110
{
111111
get
112112
{
@@ -158,7 +158,7 @@ private void ReleaseChunk(ReferenceCountedChunk chunk)
158158
{
159159
lock (_lock)
160160
{
161-
if (_chunks.Count < _maxPoolSize)
161+
if (_chunks.Count < _maxChunkCount)
162162
{
163163
_chunks.Push(chunk);
164164
}

0 commit comments

Comments
 (0)