Skip to content

Commit 29dfd0a

Browse files
author
Per Lundberg
authored
Set HTTPServer request/response timeouts (#643)
Closes #636 Signed-off-by: Per Lundberg <[email protected]>
1 parent 7a6b9f1 commit 29dfd0a

File tree

1 file changed

+11
-1
lines changed
  • simpleclient_httpserver/src/main/java/io/prometheus/client/exporter

1 file changed

+11
-1
lines changed

simpleclient_httpserver/src/main/java/io/prometheus/client/exporter/HTTPServer.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,17 @@
3636
* </pre>
3737
* */
3838
public class HTTPServer {
39+
40+
static {
41+
if (!System.getProperties().containsKey("sun.net.httpserver.maxReqTime")) {
42+
System.setProperty("sun.net.httpserver.maxReqTime", "60");
43+
}
44+
45+
if (!System.getProperties().containsKey("sun.net.httpserver.maxRspTime")) {
46+
System.setProperty("sun.net.httpserver.maxRspTime", "600");
47+
}
48+
}
49+
3950
private static class LocalByteArray extends ThreadLocal<ByteArrayOutputStream> {
4051
@Override
4152
protected ByteArrayOutputStream initialValue()
@@ -256,4 +267,3 @@ public int getPort() {
256267
return server.getAddress().getPort();
257268
}
258269
}
259-

0 commit comments

Comments
 (0)