Stdlib index
- Captured-borrow migration worklist (3.3.3)
- Owned-bind migration worklist (8.2.7)
- Return-side title audit — the ride-through enumeration
- stdlib ownership audit
- stdlib ownership dispositions (plan 1.3.1 / 4.3.1)
codec
codec / csv
codec / json
collection
- ArrayList
- BPlusTree
- Cache
- Collectors
- HashMap
- HashSet
- Heap
- ImmutableList
- ImmutableMap
- ImmutableSet
- LinkedList
- RedBlackTree
- Sort
collection / ltm
concurrent
error
gfx
hash
ifx
io
io / file
io / net
io / net / dns
io / net / tls
io / net / uri
lang
lang / stream
math
math / fft
math / linalg
math / npio
math / poly
math / random
math / stats
nucleo
- Columns — the Arrow-laid-out substrate
- Fused tensor expressions — Fuse
- Table — the lazy, typed dataframe
- Tape — define-by-run autograd
- Transform intrinsics — Grad, Vmap, Jit
process
reflect
search / distance
search / fuzzy
search / ngram
session
time
- Clock
- DateTimeFormatter
- Duration
- Instant
- LocalDate
- LocalDateTime
- LocalTime
- Period
- ZonedDateTime
- ZoneId
- ZoneOffset
wire
xpu
xpu / mesh
ServerBuilder
cajeta.io.net.ServerBuilder — the model-selection builder for a
Server, opened with Server.builder(). It is the single fluent
surface for picking which accept stack a server uses — Model A
(fiber-per-connection, the default) or Model B (event-driven shared-pool, via
ServerModel.sharedPool(n)) — without naming the concrete server class.
bind (or bindAddress) and handler are required; backlog defaults to
the platform listen backlog (UNSET_BACKLOG). The builder is a pure value
until build() is called — no I/O happens while recording choices.
ServerBuilder b #= Server.builder()
.bind("127.0.0.1:0")
.model(ServerModel.fiberPerConnection())
.handler((TcpStream conn) -> { conn.close(); });
Server s #= b.build();
Methods
| Signature | |
|---|---|
ServerBuilder bind(String addr) | Bind to a host:port (or [v6]:port) string, parsed via SocketAddress.parse |
ServerBuilder bindAddress(SocketAddress addr) | Bind to an already-parsed SocketAddress |
ServerBuilder model(ServerModel m) | Select the accept model — ServerModel.fiberPerConnection() (Model A) or ServerModel.sharedPool(n) (Model B) |
ServerBuilder handler((TcpStream) -> void h) | Set the per-connection handler, invoked once per accepted connection with the owned TcpStream |
ServerBuilder backlog(int32 backlog) | Set an explicit listen(2) backlog (the accept-queue depth) |
#Server build() ⚑ | Build the configured Server; either model returns a Server, so the caller drives the same serve() / shutdown() surface |
void serve() | Terminal convenience: build the selected server, then run its accept loop synchronously |
⚑ = @EntryPoint
See also
- Source:
runtime/src/cajeta/io/net/ServerBuilder.cajeta - Server — what it builds; HttpServerBuilder — the HTTP-layer counterpart