Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set default write queue length to 0 and display version on startup. #5118

Merged
merged 3 commits into from
Oct 7, 2022
Merged
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 @@ -16,6 +16,8 @@

package io.helidon.nima.tests.integration.server.accesslog;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
Expand Down Expand Up @@ -86,8 +88,14 @@ void testRequestsAndValidateAccessLog() throws IOException {

assertThat(response.status(), is(Http.Status.BAD_REQUEST_400));

List<String> lines = Files.readAllLines(ACCESS_LOG);
assertThat(lines, contains("127.0.0.1 - [03/Dec/2007:10:15:30 +0000] \"GET /access HTTP/1.1\" 200",
"127.0.0.1 - [03/Dec/2007:10:15:30 +0000] \"GET /wrong HTTP/1.1\" 404"));
try (FileOutputStream fos = new FileOutputStream(ACCESS_LOG.toString(), true)) {
fos.getFD().sync(); // force buffer sync
List<String> lines = Files.readAllLines(ACCESS_LOG);
System.out.println("=== BEGIN access.log ===");
lines.forEach(System.out::println);
System.out.println("=== END access.log ===");
assertThat(lines, contains("127.0.0.1 - [03/Dec/2007:10:15:30 +0000] \"GET /access HTTP/1.1\" 200",
"127.0.0.1 - [03/Dec/2007:10:15:30 +0000] \"GET /wrong HTTP/1.1\" 404"));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public static class Builder implements io.helidon.common.Builder<Builder, Listen
private int backlog = 1024;
private Tls tls;
private SocketOptions connectionOptions;
private int writeQueueLength = 32;
private int writeQueueLength = 0;
spericas marked this conversation as resolved.
Show resolved Hide resolved
private long maxPayloadSize = -1;

private Builder(String socketName) {
Expand Down Expand Up @@ -257,7 +257,7 @@ public Builder connectionOptions(Consumer<SocketOptions.Builder> builderConsumer
/**
* Number of buffers queued for write operations.
*
* @param writeQueueLength maximal number of queued writes, defaults to 32
* @param writeQueueLength maximal number of queued writes, defaults to 0
* @return updated builder
*/
public Builder writeQueueLength(int writeQueueLength) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import java.util.concurrent.locks.ReentrantLock;
import java.util.function.Consumer;

import io.helidon.common.Version;
import io.helidon.nima.webserver.http.DirectHandlers;
import io.helidon.nima.webserver.spi.ServerConnectionProvider;

Expand Down Expand Up @@ -181,7 +182,8 @@ private void startIt() {
now = System.currentTimeMillis() - now;
long uptime = ManagementFactory.getRuntimeMXBean().getUptime();

LOGGER.log(System.Logger.Level.INFO, "Níma server started all channels in "
LOGGER.log(System.Logger.Level.INFO, "Helidon Níma " + Version.VERSION);
LOGGER.log(System.Logger.Level.INFO, "Started all channels in "
+ now + " milliseconds. "
+ uptime + " milliseconds since JVM startup. "
+ "Java " + Runtime.version());
Expand Down