GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Make it possible to choose the AdaptivePoolingAllocator as Netty defa… · netty/netty@d2b20bc

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • buffer/src/main/java/io/netty5/buffer
    • DefaultBufferAllocators.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎buffer/src/main/java/io/netty5/buffer/DefaultBufferAllocators.java‎

Copy file name to clipboardExpand all lines: buffer/src/main/java/io/netty5/buffer/DefaultBufferAllocators.java
+7-3Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
*/
1515
package io.netty5.buffer;
1616

17+
import io.netty5.buffer.adapt.AdaptablePoolingAllocator;
1718
import io.netty5.util.internal.PlatformDependent;
1819
import io.netty5.util.internal.SystemPropertyUtil;
1920
import io.netty5.util.internal.logging.InternalLogger;
@@ -44,22 +45,25 @@ public final class DefaultBufferAllocators {
4445
"io.netty5.allocator.type", PlatformDependent.isAndroid() ? "unpooled" : "pooled");
4546
allocType = allocType.toLowerCase(Locale.US).trim();
4647
boolean directBufferPreferred = directBufferPreferred();
48+
String allocTypeForLogging = allocType;
4749

4850
final BufferAllocator onHeap;
4951
final BufferAllocator offHeap;
5052
if ("unpooled".equals(allocType)) {
5153
onHeap = BufferAllocator.onHeapUnpooled();
5254
offHeap = BufferAllocator.offHeapUnpooled();
53-
logger.debug("-Dio.netty5.allocator.type: {}", allocType);
5455
} else if ("pooled".equals(allocType)) {
5556
onHeap = BufferAllocator.onHeapPooled();
5657
offHeap = BufferAllocator.offHeapPooled();
57-
logger.debug("-Dio.netty5.allocator.type: {}", allocType);
58+
} else if ("adaptive".equals(allocType)) {
59+
onHeap = new AdaptablePoolingAllocator(false);
60+
offHeap = new AdaptablePoolingAllocator(true);
5861
} else {
5962
onHeap = BufferAllocator.onHeapPooled();
6063
offHeap = BufferAllocator.offHeapPooled();
61-
logger.debug("-Dio.netty5.allocator.type: pooled (unknown: {})", allocType);
64+
allocTypeForLogging = "pooled (unknown: " + allocType + ')';
6265
}
66+
logger.debug("-Dio.netty5.allocator.type: {}", allocTypeForLogging);
6367
UncloseableBufferAllocator onHeapUnclosable = new UncloseableBufferAllocator(onHeap);
6468
UncloseableBufferAllocator offHeapUnclosable = new UncloseableBufferAllocator(offHeap);
6569
DEFAULT_PREFERRED_ALLOCATOR = directBufferPreferred? offHeapUnclosable : onHeapUnclosable;

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.