Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #132 - ClientConnector abstraction. #3267

Merged
merged 4 commits into from
Jan 31, 2019

Conversation

sbordet
Copy link
Contributor

@sbordet sbordet commented Jan 17, 2019

Issue #132.

The main changes are a new ClientConnector class and refactored AbstractConnectorHttpClientTransport (which impacts both HttpClientTransportOverHTTP and HttpClientTransportOverFCGI), HTTP2Client and HttpClientTransportOverHTTP2.

The rest is just small modifications and simplifications to make everything work as before.

Introduced ClientConnector and refactored HttpClient transports,
removing duplicated code that was connect() to a remote host.

Refactored also HTTP2Client to reference ClientConnector.

Refactored tests accordingly to the changes introduced in the
implementations.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
@sbordet sbordet requested review from gregw and joakime January 17, 2019 09:50
protected void doStart() throws Exception
{
if (executor == null)
setExecutor(new QueuedThreadPool());
Copy link
Contributor

@joakime joakime Jan 17, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a "client" name to this QTP for troubleshooting reasons.

Copy link
Contributor

@joakime joakime left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than minor niggle with named QTP for client, I'm good.

Added name to default executor and scheduler after review.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Rewrote HttpClientTransportOverUnixSockets in light of ClientConnector.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Reverted refactoring of newConnection() to avoid
to bind the class to a too specific abstract method.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Copy link
Contributor

@gregw gregw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've not really had time to look in detail, but a quick looks reveals nothing but minor questions.

However, I'm still not seeing exactly how you build up the dynamic capabilities of the client by adding transports that will then be reflected as available ConnectionFactories? Perhaps some examples of setting up strange configurations would help?

I'll look again tomorrow... but don't wait for me if you have a +1 already.

getClientConnector().setSelectors(selectors);
}

public HttpClientTransportOverHTTP(ClientConnector connector)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't the ultimate constructor be HttpClientTransportOverHTTP(ClientConnector connector, int selectors)?

private int inputBufferSize = 8192;
private List<String> protocols = Arrays.asList("h2", "h2-17", "h2-16", "h2-15", "h2-14");
private List<String> protocols = List.of("h2");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

\o/

protected SslContextFactory newSslContextFactory()
{
SslContextFactory sslContextFactory = new SslContextFactory(false);
sslContextFactory.setEndpointIdentificationAlgorithm("HTTPS");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps it is time to do this by default in new SslContextFactory?

{
@SuppressWarnings("unchecked")
Map<String, Object> context = (Map<String, Object>)attachment;
ClientConnectionFactory factory = (ClientConnectionFactory)context.get(CLIENT_CONNECTION_FACTORY_CONTEXT_KEY);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the connection factory a function of context and not the Connector (like the server?)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see... it comes from the destination!

@sbordet sbordet merged commit e939cd2 into jetty-10.0.x Jan 31, 2019
@sbordet sbordet deleted the jetty-10.0.x-132_client_connector branch January 31, 2019 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants