Package com.kristensoft.kdc
Class KristenHttpServerParameters.Builder
- java.lang.Object
-
- com.kristensoft.kdc.Parameters.Builder<T>
-
- com.kristensoft.kdc.ServerParameters.Builder<KristenHttpServerParameters.Builder>
-
- com.kristensoft.kdc.KristenHttpServerParameters.Builder
-
- Enclosing class:
- KristenHttpServerParameters
public static final class KristenHttpServerParameters.Builder extends ServerParameters.Builder<KristenHttpServerParameters.Builder>
BuildsKristenHttpServerParametersinstances.
-
-
Constructor Summary
Constructors Constructor Description Builder()Creates a builder for configuring HTTP server parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description KristenHttpServerParameters.BuilderaddEventHandler(KristenHttpServerEventHandler handler)Adds an HTTP server event handler.KristenHttpServerParameters.BuilderaddEventHandlers(List<KristenHttpServerEventHandler> handlers)Adds the specified HTTP server event handlers.KristenHttpServerParametersbuild()Builds the configuredKristenHttpServerParameters.KristenHttpServerParameters.BuilderwithCorePoolSize(int corePoolSize)Sets the core number of threads used to process HTTP requests.KristenHttpServerParameters.BuilderwithEventHandlers(List<KristenHttpServerEventHandler> handlers)Replaces the currently configured HTTP server event handlers with the specified handlers.KristenHttpServerParameters.BuilderwithKeepAliveTime(long keepAliveTime)Sets the amount of time excess idle threads may remain alive.KristenHttpServerParameters.BuilderwithMaxPoolSize(int maxPoolSize)Sets the maximum number of threads used to process HTTP requests.KristenHttpServerParameters.BuilderwithTimeUnit(TimeUnit timeUnit)Sets the time unit used for the thread keep-alive time.KristenHttpServerParameters.BuilderwithUriPath(String uriPathString)Sets the URI path used for the default HTTP context.-
Methods inherited from class com.kristensoft.kdc.ServerParameters.Builder
withBacklog
-
Methods inherited from class com.kristensoft.kdc.Parameters.Builder
addWhiteListEntry, registerApi, registerApi, registerApis, withAutoStart, withBindAddress, withBindAddress, withBindAddress, withCompressed, withConnectionQueuePoolSize, withCrc, withEncryptionKey, withLatencyMode, withLatencyReportingInterval, withMaxReceivedBufferSize, withMaxSendBufferSize, withSerializationFormat, withWhiteList
-
-
-
-
Method Detail
-
withUriPath
public KristenHttpServerParameters.Builder withUriPath(String uriPathString)
Sets the URI path used for the default HTTP context.- Parameters:
uriPathString- the URI path, beginning with/- Returns:
- this builder
- Throws:
IllegalArgumentException- ifuriPathStringisnull, empty, or does not begin with/
-
withCorePoolSize
public KristenHttpServerParameters.Builder withCorePoolSize(int corePoolSize)
Sets the core number of threads used to process HTTP requests.- Parameters:
corePoolSize- the core thread pool size- Returns:
- this builder
- Throws:
IllegalArgumentException- ifcorePoolSizeis less than or equal to zero
-
withMaxPoolSize
public KristenHttpServerParameters.Builder withMaxPoolSize(int maxPoolSize)
Sets the maximum number of threads used to process HTTP requests.- Parameters:
maxPoolSize- the maximum thread pool size- Returns:
- this builder
- Throws:
IllegalArgumentException- ifmaxPoolSizeis less than or equal to zero
-
withKeepAliveTime
public KristenHttpServerParameters.Builder withKeepAliveTime(long keepAliveTime)
Sets the amount of time excess idle threads may remain alive.- Parameters:
keepAliveTime- the thread keep-alive time- Returns:
- this builder
- Throws:
IllegalArgumentException- ifkeepAliveTimeis less than or equal to zero
-
withTimeUnit
public KristenHttpServerParameters.Builder withTimeUnit(TimeUnit timeUnit)
Sets the time unit used for the thread keep-alive time.- Parameters:
timeUnit- the keep-alive time unit- Returns:
- this builder
- Throws:
IllegalArgumentException- iftimeUnitisnull
-
addEventHandler
public KristenHttpServerParameters.Builder addEventHandler(KristenHttpServerEventHandler handler)
Adds an HTTP server event handler.- Parameters:
handler- the event handler to add- Returns:
- this builder
- Throws:
IllegalArgumentException- ifhandlerisnull
-
addEventHandlers
public KristenHttpServerParameters.Builder addEventHandlers(List<KristenHttpServerEventHandler> handlers)
Adds the specified HTTP server event handlers.- Parameters:
handlers- the event handlers to add- Returns:
- this builder
- Throws:
IllegalArgumentException- ifhandlersisnullor contains anullelement
-
withEventHandlers
public KristenHttpServerParameters.Builder withEventHandlers(List<KristenHttpServerEventHandler> handlers)
Replaces the currently configured HTTP server event handlers with the specified handlers.- Parameters:
handlers- the event handlers to use- Returns:
- this builder
- Throws:
IllegalArgumentException- ifhandlersisnullor contains anullelement
-
build
public KristenHttpServerParameters build()
Builds the configuredKristenHttpServerParameters.- Specified by:
buildin classServerParameters.Builder<KristenHttpServerParameters.Builder>- Returns:
- the configured HTTP server parameters
- Throws:
IllegalArgumentException- if the core thread pool size is greater than the maximum thread pool size
-
-