Skip to content

Commit

Permalink
Netty - Move to @ConfigMapping
Browse files Browse the repository at this point in the history
  • Loading branch information
gsmet committed Feb 4, 2025
1 parent 4703297 commit 687b840
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 13 deletions.
3 changes: 0 additions & 3 deletions extensions/netty/deployment/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@
<version>${project.version}</version>
</path>
</annotationProcessorPaths>
<compilerArgs>
<arg>-AlegacyConfigRoot=true</arg>
</compilerArgs>
</configuration>
</execution>
</executions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

import java.util.OptionalInt;

import io.quarkus.runtime.annotations.ConfigItem;
import io.quarkus.runtime.annotations.ConfigPhase;
import io.quarkus.runtime.annotations.ConfigRoot;
import io.smallrye.config.ConfigMapping;

@ConfigRoot(name = "netty", phase = ConfigPhase.BUILD_TIME)
public class NettyBuildTimeConfig {
@ConfigRoot(phase = ConfigPhase.BUILD_TIME)
@ConfigMapping(prefix = "quarkus.netty")
public interface NettyBuildTimeConfig {

/**
* The value configuring the {@code io.netty.allocator.maxOrder} system property of Netty.
Expand All @@ -19,6 +20,5 @@ public class NettyBuildTimeConfig {
* It must be used carefully.
* More details on https://programmer.group/pool-area-of-netty-memory-pool.html.
*/
@ConfigItem
public OptionalInt allocatorMaxOrder;
public OptionalInt allocatorMaxOrder();
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public NativeImageSystemPropertyBuildItem limitMem() {
@BuildStep
public SystemPropertyBuildItem limitArenaSize(NettyBuildTimeConfig config,
List<MinNettyAllocatorMaxOrderBuildItem> minMaxOrderBuildItems) {
String maxOrder = calculateMaxOrder(config.allocatorMaxOrder, minMaxOrderBuildItems, true);
String maxOrder = calculateMaxOrder(config.allocatorMaxOrder(), minMaxOrderBuildItems, true);

//in native mode we limit the size of the epoll array
//if the array overflows the selector just moves the overflow to a map
Expand Down Expand Up @@ -114,7 +114,7 @@ NativeImageConfigBuildItem build(
.produce(ReflectiveClassBuildItem.builder("java.util.LinkedHashMap").build());
reflectiveClass.produce(ReflectiveClassBuildItem.builder("sun.nio.ch.SelectorImpl").methods().fields().build());

String maxOrder = calculateMaxOrder(config.allocatorMaxOrder, minMaxOrderBuildItems, false);
String maxOrder = calculateMaxOrder(config.allocatorMaxOrder(), minMaxOrderBuildItems, false);

NativeImageConfigBuildItem.Builder builder = NativeImageConfigBuildItem.builder()
// Use small chunks to avoid a lot of wasted space. Default is 16mb * arenas (derived from core count)
Expand Down
3 changes: 0 additions & 3 deletions extensions/netty/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,6 @@
<version>${project.version}</version>
</path>
</annotationProcessorPaths>
<compilerArgs>
<arg>-AlegacyConfigRoot=true</arg>
</compilerArgs>
</configuration>
</execution>
</executions>
Expand Down

0 comments on commit 687b840

Please sign in to comment.