Class NetworkConfig
-
- All Implemented Interfaces:
public final class NetworkConfigSettings-group for the timeouts applied to every outbound HTTP call ServerPackCreator makes.
These exist because the JDK's default is to wait forever: an
HttpURLConnectionwith no timeouts set never gives up on a host which accepts the connection and then goes silent, which is exactly what a black-holing firewall or a stalled upstream looks like. Twelve manifest checks sit on the blocking startup path, so an unbounded wait there is a hang with no recovery rather than a slow start.Two timeouts are separate on purpose, because they answer different questions:
connect bounds reaching the host at all, and can be short — either the TCP handshake completes quickly or the host is not there.
read bounds how long a single read may block waiting for bytes. It is not a budget for the whole transfer, which is why a multi-megabyte download does not need a huge value — only a host that stalls mid-stream for longer than the timeout trips it.
downloadReadTimeout is nevertheless separate from readTimeout because the two are used against different things: a metadata manifest either answers promptly or is broken, while an installer or mod jar is legitimately served by hosts that trickle bytes under load.
-
-
Field Summary
Fields Modifier and Type Field Description public final static StringCONNECT_TIMEOUT_KEYpublic final static StringREAD_TIMEOUT_KEYpublic final static StringDOWNLOAD_READ_TIMEOUT_KEYpublic final static IntegerDEFAULT_CONNECT_TIMEOUTpublic final static IntegerDEFAULT_READ_TIMEOUTpublic final static IntegerDEFAULT_DOWNLOAD_READ_TIMEOUTprivate final IntegerfallbackConnectTimeoutprivate final IntegerfallbackReadTimeoutprivate final IntegerfallbackDownloadReadTimeoutprivate IntegerconnectTimeoutprivate IntegerreadTimeoutprivate IntegerdownloadReadTimeout
-
Constructor Summary
Constructors Constructor Description NetworkConfig(PropertyStore store)
-
Method Summary
Modifier and Type Method Description final IntegergetFallbackConnectTimeout()final IntegergetFallbackReadTimeout()final IntegergetFallbackDownloadReadTimeout()final IntegergetConnectTimeout()final UnitsetConnectTimeout(Integer value)final IntegergetReadTimeout()final UnitsetReadTimeout(Integer value)final IntegergetDownloadReadTimeout()final UnitsetDownloadReadTimeout(Integer value)-
-
Constructor Detail
-
NetworkConfig
NetworkConfig(PropertyStore store)
-
-
Method Detail
-
getFallbackConnectTimeout
final Integer getFallbackConnectTimeout()
-
getFallbackReadTimeout
final Integer getFallbackReadTimeout()
-
getFallbackDownloadReadTimeout
final Integer getFallbackDownloadReadTimeout()
-
getConnectTimeout
final Integer getConnectTimeout()
-
setConnectTimeout
final Unit setConnectTimeout(Integer value)
-
getReadTimeout
final Integer getReadTimeout()
-
setReadTimeout
final Unit setReadTimeout(Integer value)
-
getDownloadReadTimeout
final Integer getDownloadReadTimeout()
-
setDownloadReadTimeout
final Unit setDownloadReadTimeout(Integer value)
-
-
-
-