Construct the Server, given the provided ServiceFactory.
Construct the Server, given the provided ServiceFactory. This is useful if the protocol is stateful (e.g., requires authentication or supports transactions).
Construct the Server, given the provided Service.
Cancel pending futures whenever the the connection is shut down.
Cancel pending futures whenever the the connection is shut down. This defaults to true.
When true, the server is daemonized.
When true, the server is daemonized. As with java threads, a process can only exit only when all remaining servers are daemonized. False by default.
Configure admission control filters in the server Stack.
Configure admission control filters in the server Stack.
com.twitter.finagle.filter.ServerAdmissionControl
Provide an alternative to putting all request exceptions under a "failures" stat.
Provide an alternative to putting all request exceptions under a "failures" stat. Typical implementations may report any cancellations or validation errors separately so success rate considers only valid non cancelled requests.
function to record failure details.
Configures the maximum concurrent requests that are admitted by the server at any given time.
Configures the maximum concurrent requests that are admitted
by the server at any given time. If the server receives a
burst of traffic that exceeds this limit, the burst is rejected
with a Failure.Rejected exception. Note, this failure signals
a graceful rejection which is transmitted to clients by certain
protocols in Finagle (e.g. Http, ThriftMux).
Provide a raw SSL engine that is used to establish SSL sessions.
Overrides the stack and com.twitter.finagle.Server that will be used by this builder.
Overrides the stack and com.twitter.finagle.Server that will be used by this builder.
A StackBasedServer representation of a
com.twitter.finagle.Server. server is materialized with the state of
configuration when build is called. There is no guarantee that all
builder parameters will be used by the resultant Server; it is up to the
discretion of server itself and the protocol implementation.
Configures the traffic class.
Configures the traffic class.
Listener.TrafficClass
Construct a Service, with runtime checks for builder completeness.
(Since version 5.0.1) Used for ABI compat
Construct the Server, given the provided ServiceFactory.
Construct the Server, given the provided ServiceFactory. This is useful if the protocol is stateful (e.g., requires authentication or supports transactions).
(Since version 5.0.1) Use the ServiceFactory variant instead
Construct the Server, given the provided Service factory.
Construct the Server, given the provided Service factory.
(Since version 5.0.1) Use the ServiceFactory variant instead
(Since version 5.0.1) Used for ABI compat
(Since version 2015-11-18) use com.twitter.finagle.netty3.numWorkers flag instead
Overrides the stack and com.twitter.finagle.Server that will be used by this builder.
Overrides the stack and com.twitter.finagle.Server that will be used by this builder.
A function that materializes a Server from a set of Params.
mk is passed the state of configuration when build is called. There is
no guarantee that all the builder parameters will be used by the server
created by mk; it is up to the discretion of the server and protocol
implementation.
(Since version 7.0.0) Use stack(server: StackBasedServer)
(Since version 7.0.0) Use tracer() instead
(Since version 7.0.0) Use tracer() instead
A handy Builder for constructing Servers (i.e., binding Services to a port). This class is subclassable. Override copy() and build() to do your own dirty work.
The main class to use is com.twitter.finagle.builder.ServerBuilder, as so
The
ServerBuilderrequires the definition ofcodec,bindToandname. In Scala, these are statically type checked, and in Java the lack of any of the above causes a runtime error.The
buildmethod uses an implicit argument to statically typecheck the builder (to ensure completeness, see above). The Java compiler cannot provide such implicit, so we provide a separate function in Java to accomplish this. Thus, the Java code for the above isAlternatively, using the
unsafeBuildmethod onServerBuilderverifies the builder dynamically, resulting in a runtime error instead of a compiler error.Defaults
The following defaults are applied to servers constructed via ServerBuilder, unless overridden with the corresponding method. These defaults were chosen carefully so as to work well for most use cases. Before changing any of them, make sure that you know exactly how they will affect your application -- these options are typically only changed by expert users.
-
openConnectionsThresholds: None -maxConcurrentRequests: Int.MaxValue -backlog: OS-defined default value