netty: Removed 4096 min buffer size (#11856) · grpc/grpc-java@7153ff8

2 files changed

lines changed

Original file line numberDiff line numberDiff line change

@@ -33,9 +33,6 @@

3333

*/

3434

class NettyWritableBufferAllocator implements WritableBufferAllocator {

3535
36-

// Use 4k as our minimum buffer size.

37-

private static final int MIN_BUFFER = 4 * 1024;

38-
3936

// Set the maximum buffer size to 1MB.

4037

private static final int MAX_BUFFER = 1024 * 1024;

4138

@@ -47,7 +44,7 @@ class NettyWritableBufferAllocator implements WritableBufferAllocator {

4744
4845

@Override

4946

public WritableBuffer allocate(int capacityHint) {

50-

capacityHint = Math.min(MAX_BUFFER, Math.max(MIN_BUFFER, capacityHint));

47+

capacityHint = Math.min(MAX_BUFFER, capacityHint);

5148

return new NettyWritableBuffer(allocator.buffer(capacityHint, capacityHint));

5249

}

5350

}

Original file line numberDiff line numberDiff line change

@@ -40,13 +40,6 @@ protected WritableBufferAllocator allocator() {

4040

return allocator;

4141

}

4242
43-

@Test

44-

public void testCapacityHasMinimum() {

45-

WritableBuffer buffer = allocator().allocate(100);

46-

assertEquals(0, buffer.readableBytes());

47-

assertEquals(4096, buffer.writableBytes());

48-

}

49-
5043

@Test

5144

public void testCapacityIsExactAboveMinimum() {

5245

WritableBuffer buffer = allocator().allocate(9000);