diff --git a/oap-http/oap-pnio-v3/src/main/java/oap/http/pniov3/PnioHttpHandler.java b/oap-http/oap-pnio-v3/src/main/java/oap/http/pniov3/PnioHttpHandler.java index 613b103a0..886a23687 100644 --- a/oap-http/oap-pnio-v3/src/main/java/oap/http/pniov3/PnioHttpHandler.java +++ b/oap-http/oap-pnio-v3/src/main/java/oap/http/pniov3/PnioHttpHandler.java @@ -9,10 +9,8 @@ package oap.http.pniov3; -import com.google.common.base.Preconditions; import io.undertow.io.Receiver; import io.undertow.util.SameThreadExecutor; -import lombok.Builder; import lombok.extern.slf4j.Slf4j; import oap.http.server.nio.HttpServerExchange; @@ -21,35 +19,26 @@ @Slf4j public class PnioHttpHandler implements PnioHttpHandlerReference { public final String uniqueName; - - public final int requestSize; - public final int responseSize; - public final int ioQueueSize; - public final boolean important; public final PnioListener pnioListener; public final ConcurrentHashMap> exchanges = new ConcurrentHashMap<>(); private final PnioController pnioController; private final PnioMetrics metrics; + public int requestSize = 64 * 1024; + public int responseSize = 32 * 1024; + public boolean important = false; public ComputeTask task; public PnioHttpHandler( String uniqueName, - PnioHttpSettings settings, ComputeTask task, PnioListener pnioListener, PnioController pnioController ) { this.uniqueName = uniqueName; - this.requestSize = settings.requestSize; - this.responseSize = settings.responseSize; - this.ioQueueSize = settings.ioQueueSize; - this.important = settings.important; this.task = task; this.pnioListener = pnioListener; this.pnioController = pnioController; this.metrics = new PnioMetrics( uniqueName ); - - Preconditions.checkArgument( settings.responseSize > 0, "responseSize must be greater than 0" ); } public void handleRequest( HttpServerExchange oapExchange, long timeout, RequestState requestState ) { @@ -108,12 +97,4 @@ public void handleRequest( HttpServerExchange oapExchange, long timeout, Request public PnioHttpHandler getPnioHttpHandler() { return this; } - - @Builder - public static class PnioHttpSettings { - int requestSize; - int responseSize; - int ioQueueSize; - boolean important; - } } diff --git a/oap-http/oap-pnio-v3/src/test/java/oap/http/pniov3/PerformanceTest.java b/oap-http/oap-pnio-v3/src/test/java/oap/http/pniov3/PerformanceTest.java index efdbce204..7ab67a891 100644 --- a/oap-http/oap-pnio-v3/src/test/java/oap/http/pniov3/PerformanceTest.java +++ b/oap-http/oap-pnio-v3/src/test/java/oap/http/pniov3/PerformanceTest.java @@ -32,17 +32,13 @@ public void test() throws IOException { int port = 12345; - PnioHttpHandler.PnioHttpSettings settings = PnioHttpHandler.PnioHttpSettings.builder() - .requestSize( 64000 ) - .responseSize( 64000 ) - .build(); try( PnioController pnioController = new PnioController( 10, 10000 ); NioHttpServer httpServer = new NioHttpServer( new NioHttpServer.DefaultPort( port ) ) ) { httpServer.ioThreads = 2; httpServer.statistics = true; httpServer.start(); - PnioHttpHandler httpHandler = new PnioHttpHandler<>( "perf", settings, new TestHandler(), new PnioHttpHandlerTest.TestPnioListener(), pnioController ); + PnioHttpHandler httpHandler = new PnioHttpHandler<>( "perf", new TestHandler(), new PnioHttpHandlerTest.TestPnioListener(), pnioController ); Scheduler.scheduleWithFixedDelay( 10, TimeUnit.SECONDS, () -> { System.out.println(); diff --git a/oap-http/oap-pnio-v3/src/test/java/oap/http/pniov3/PnioHttpHandlerTest.java b/oap-http/oap-pnio-v3/src/test/java/oap/http/pniov3/PnioHttpHandlerTest.java index 4ae5ecfa7..decb0f6fb 100644 --- a/oap-http/oap-pnio-v3/src/test/java/oap/http/pniov3/PnioHttpHandlerTest.java +++ b/oap-http/oap-pnio-v3/src/test/java/oap/http/pniov3/PnioHttpHandlerTest.java @@ -273,16 +273,14 @@ private void runWithWorkflow( int requestSize, int responseSize, int ioThreads, int maxThreads, long timeout, ComputeTask task, Consumer cons ) throws IOException { int port = Ports.getFreePort( getClass() ); - PnioHttpHandler.PnioHttpSettings settings = PnioHttpHandler.PnioHttpSettings.builder() - .requestSize( requestSize ) - .responseSize( responseSize ) - .build(); try( NioHttpServer httpServer = new NioHttpServer( new NioHttpServer.DefaultPort( port ) ) ) { httpServer.ioThreads = ioThreads; httpServer.start(); try( PnioController pnioController = new PnioController( ioThreads, maxThreads ) ) { - PnioHttpHandler httpHandler = new PnioHttpHandler<>( "test", settings, task, new TestPnioListener(), pnioController ); + PnioHttpHandler httpHandler = new PnioHttpHandler<>( "test", task, new TestPnioListener(), pnioController ); + httpHandler.requestSize = requestSize; + httpHandler.responseSize = responseSize; httpServer.bind( "/test", exchange -> httpHandler.handleRequest( exchange, timeout, new TestState() ), false ); diff --git a/pom.xml b/pom.xml index 380b7af61..f495da37d 100644 --- a/pom.xml +++ b/pom.xml @@ -57,7 +57,7 @@ - 25.4.8 + 25.4.9 25.0.1 25.0.0