gabriel119435
gabriel119435

Reputation: 6832

Using embedded jetty, how I link a ServerConnector to a Server?

More specifically, what's the difference between ServerConnector connector = new ServerConnector(server) and server.addConnector(connector)? Are they exclusive? Redundant?

Upvotes: 1

Views: 60

Answers (1)

Joakim Erdfelt
Joakim Erdfelt

Reputation: 49525

One creates, one uses.

ServerConnector connector = new ServerConnector(server);

That creates a ServerConnector, initialized from the state of the Server (various configuration, threadpools, schedulers, bufferpools, beans, etc) at that point in time.

server.addConnector(connector);

That uses the connector, by adding it to the server for bean and lifecycle management.

Upvotes: 1

Related Questions