Skip to content

Commit 6b07629

Browse files
author
Stefania Alborghetti
committed
DB-2993: renamed methods as per code review
1 parent 2f8a6cf commit 6b07629

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

buffer/src/main/java/io/netty/buffer/PoolArena.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,7 @@ protected PoolChunk<ByteBuffer> newUnpooledChunk(int capacity) {
761761

762762
@Override
763763
protected void destroyChunk(PoolChunk<ByteBuffer> chunk) {
764-
PlatformDependent.freeDirectBuffer(chunk.memory);
764+
PlatformDependent.freeDirect(chunk.memory);
765765
}
766766

767767
@Override

buffer/src/main/java/io/netty/buffer/UnpooledDirectByteBuf.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,14 @@ protected UnpooledDirectByteBuf(ByteBufAllocator alloc, ByteBuffer initialBuffer
103103
* Allocate a new direct {@link ByteBuffer} with the given initialCapacity.
104104
*/
105105
protected ByteBuffer allocateDirect(int initialCapacity) {
106-
return PlatformDependent.allocateDirectJVM(initialCapacity);
106+
return PlatformDependent.allocateDirectWithCleaner(initialCapacity);
107107
}
108108

109109
/**
110110
* Free a direct {@link ByteBuffer}
111111
*/
112112
protected void freeDirect(ByteBuffer buffer) {
113-
PlatformDependent.freeDirectBufferJVM(buffer);
113+
PlatformDependent.freeDirectWithCleaner(buffer);
114114
}
115115

116116
private void setByteBuffer(ByteBuffer buffer) {

buffer/src/main/java/io/netty/buffer/UnpooledUnsafeDirectByteBuf.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,14 @@ protected UnpooledUnsafeDirectByteBuf(ByteBufAllocator alloc, ByteBuffer initial
117117
* Allocate a new direct {@link ByteBuffer} with the given initialCapacity.
118118
*/
119119
protected ByteBuffer allocateDirect(int initialCapacity) {
120-
return PlatformDependent.allocateDirectJVM(initialCapacity);
120+
return PlatformDependent.allocateDirectWithCleaner(initialCapacity);
121121
}
122122

123123
/**
124124
* Free a direct {@link ByteBuffer}
125125
*/
126126
protected void freeDirect(ByteBuffer buffer) {
127-
PlatformDependent.freeDirectBufferJVM(buffer);
127+
PlatformDependent.freeDirectWithCleaner(buffer);
128128
}
129129

130130
final void setByteBuffer(ByteBuffer buffer, boolean tryFree) {

common/src/main/java/io/netty/util/internal/PlatformDependent.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -574,22 +574,22 @@ public static void setMemory(long address, long bytes, byte value) {
574574
public static ByteBuffer allocateDirect(int capacity) {
575575
return USE_DIRECT_BUFFER_NO_CLEANER
576576
? PlatformDependent.allocateDirectNoCleaner(capacity)
577-
: allocateDirectJVM(capacity);
577+
: allocateDirectWithCleaner(capacity);
578578
}
579579

580-
public static void freeDirectBuffer(ByteBuffer buffer) {
580+
public static void freeDirect(ByteBuffer buffer) {
581581
if (USE_DIRECT_BUFFER_NO_CLEANER) {
582582
PlatformDependent.freeDirectNoCleaner(buffer);
583583
} else {
584-
PlatformDependent.freeDirectBufferJVM(buffer);
584+
PlatformDependent.freeDirectWithCleaner(buffer);
585585
}
586586
}
587587

588588
/**
589589
* Allocate a new {@link ByteBuffer} with the given {@code capacity}. {@link ByteBuffer}s allocated with
590-
* this method <strong>MUST</strong> be deallocated via {@link #freeDirectNoCleaner(ByteBuffer)}.
590+
* this method <strong>MUST</strong> be deallocated via {@link #freeDirectWithCleaner(ByteBuffer)}.
591591
*/
592-
public static ByteBuffer allocateDirectJVM(int capacity) {
592+
public static ByteBuffer allocateDirectWithCleaner(int capacity) {
593593
incrementMemoryCounter(capacity);
594594
try {
595595
return ByteBuffer.allocateDirect(capacity);
@@ -604,7 +604,7 @@ public static ByteBuffer allocateDirectJVM(int capacity) {
604604
* Try to deallocate the specified direct {@link ByteBuffer}. Please note this method does nothing if
605605
* the current platform does not support this operation or the specified buffer is not a direct buffer.
606606
*/
607-
public static void freeDirectBufferJVM(ByteBuffer buffer) {
607+
public static void freeDirectWithCleaner(ByteBuffer buffer) {
608608
int capacity = buffer.capacity();
609609
CLEANER.freeDirectBuffer(buffer);
610610
decrementMemoryCounter(capacity);

microbench/src/main/java/io/netty/microbench/handler/ssl/AbstractSslEngineBenchmark.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,12 @@ ByteBuffer newBuffer(int size) {
109109
DIRECT {
110110
@Override
111111
ByteBuffer newBuffer(int size) {
112-
return PlatformDependent.allocateDirectJVM(size);
112+
return PlatformDependent.allocateDirectWithCleaner(size);
113113
}
114114

115115
@Override
116116
void freeBuffer(ByteBuffer buffer) {
117-
PlatformDependent.freeDirectBufferJVM(buffer);
117+
PlatformDependent.freeDirectWithCleaner(buffer);
118118
}
119119
};
120120

0 commit comments

Comments
 (0)