Skip to content

Commit

Permalink
Expose socket timeouts.
Browse files Browse the repository at this point in the history
  • Loading branch information
noboomu committed Sep 14, 2020
1 parent f91ff64 commit 2621026
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ Proteus Changelog.
## Unreleased
### No issue

**Fix for looping requests when response wrapped in completable future.**


[f91ff64db7a64ea](https://github.com/noboomu/proteus/commit/f91ff64db7a64ea) Joshua Bauer *2020-09-14 19:41:59*

**Cleanup shutdown and expose worker in request.**


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.apache.commons.lang3.time.DurationFormatUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xnio.Options;

import javax.ws.rs.core.MediaType;
import java.io.ByteArrayOutputStream;
Expand Down Expand Up @@ -314,12 +315,15 @@ public void buildServer()

Undertow.Builder undertowBuilder = Undertow.builder().addHttpListener(httpPort, config.getString("application.host"))


.setBufferSize(Long.valueOf(config.getMemorySize("undertow.bufferSize").toBytes()).intValue())
.setIoThreads(Runtime.getRuntime().availableProcessors() * config.getInt("undertow.ioThreadsMultiplier"))
.setWorkerThreads(Runtime.getRuntime().availableProcessors() * config.getInt("undertow.workerThreadMultiplier"))
.setDirectBuffers(config.getBoolean("undertow.directBuffers"))
.setSocketOption(org.xnio.Options.BACKLOG, config.getInt("undertow.socket.backlog"))
.setSocketOption(org.xnio.Options.REUSE_ADDRESSES, config.getBoolean("undertow.socket.reuseAddresses"))
.setSocketOption(org.xnio.Options.READ_TIMEOUT, config.getInt("undertow.socket.readTimeout"))
.setSocketOption(org.xnio.Options.WRITE_TIMEOUT, config.getInt("undertow.socket.writeTimeout"))
.setServerOption(UndertowOptions.ENABLE_HTTP2, config.getBoolean("undertow.server.enableHttp2"))
.setServerOption(UndertowOptions.ALWAYS_SET_DATE, config.getBoolean("undertow.server.alwaysSetDate"))
.setServerOption(UndertowOptions.ALWAYS_SET_KEEP_ALIVE, config.getBoolean("undertow.server.alwaysSetKeepAlive"))
Expand Down
5 changes: 4 additions & 1 deletion proteus-core/src/main/resources/reference.conf
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ swagger {

undertow
{
# refer to https://undertow.io/javadoc/2.0.x/io/undertow/UndertowOptions.html for details
server {

alwaysSetDate = true
alwaysSetKeepAlive = false
recordRequestStartTime = false
Expand All @@ -185,9 +185,12 @@ undertow

}

# refer to https://docs.jboss.org/xnio/3.0/api/org/xnio/Options.html for details
socket {
backlog = 10000
reuseAddresses = true
readTimeout = 90000
writeTimeout = 90000
}


Expand Down
2 changes: 2 additions & 0 deletions proteus-core/src/test/resources/application.conf
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ undertow

socket {
backlog = 10000
readTimeout = 90000
writeTimeout = 90000
}


Expand Down

0 comments on commit 2621026

Please sign in to comment.