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.
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.
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
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
ServerBuilder
requires the definition ofcodec
,bindTo
andname
. In Scala, these are statically type checked, and in Java the lack of any of the above causes a runtime error.The
build
method 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
unsafeBuild
method onServerBuilder
verifies 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