Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ public enum PoolingPolicy {
*/
UnpooledHeap,

UnpooledDirect,

/**
* Use Direct memory for all buffers and pool the memory.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public ByteBuf buffer(int initialCapacity) {

@Override
public ByteBuf buffer(int initialCapacity, int maxCapacity) {
if (poolingPolicy == PoolingPolicy.PooledDirect) {
if (poolingPolicy == PoolingPolicy.PooledDirect || poolingPolicy == PoolingPolicy.UnpooledDirect) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PooledDirect and UnpooledDirect have the same implementation logic, so what's the point of adding this enumeration? I don't quite understand the purpose of your change.

Also, for the new types, I suggest adding testcase coverage.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

poolingPolicy == PoolingPolicy.PooledDirect condition in newDirectBuffer

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unpooled did the same thing here

poolingPolicy == PoolingPolicy.PooledDirect condition in newDirectBuffer

return newDirectBuffer(initialCapacity, maxCapacity, true /* can fallback to heap if needed */);
} else {
return newHeapBuffer(initialCapacity, maxCapacity);
Expand Down
Loading