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

Deprecate one-way boolean settings on builders #1750

Merged
merged 8 commits into from
Sep 10, 2021

Conversation

chemicL
Copy link
Contributor

@chemicL chemicL commented Aug 25, 2021

Motivation:

Some builder APIs allow disabling some feature without the option to
enable it. To keep the builders' APIs consistent all boolean settings
should accept a flag that can trigger the feature to on or off
configuration. This change deprecates the undesired methods and adds
methods that accept a boolean.

Modifications:

  • Deprecated GrpcClientBuilder.disableHostHeaderFallback in favor of
    GrpcClientBuilder.hostHeaderFallback(boolean),
  • Deprecated GrpcClientBuilder.disableDrainingRequestPayloadBody in
    favor of GrpcClientBuilder.drainRequestPayloadBody(boolean),
  • Deprecated HttpReporter.Builder.disableSpanBatching in favor of
    HttpReporter.Builder.spansBatchingEnabled(boolean),
  • Deprecated HttpServerBuilder.disableDrainingRequestPayloadBody in
    favor of HttpServerBuilder.drainRequestPayloadBody(boolean),
  • Deprecated SingleAddressHttpClientBuilder.disableHostHeaderFallback
    in favor of
    SingleAddressHttpClientBuilder.hostHeaderFallback(boolean).

Result:

More consistent builders' APIs.

Motivation:

Some builder APIs allow disabling some feature without the option to
enable it. To keep the builders' APIs consistent all boolean settings
should accept a flag that can trigger the feature to on or off
configuration. This change deprecates the undesired methods and adds
methods that accept a boolean.

Modifications:

- Deprecated `GrpcClientBuilder.disableHostHeaderFallback` in favor of
  `GrpcClientBuilder.hostHeaderFallback(boolean)`,
- Deprecated `GrpcClientBuilder.disableDrainingRequestPayloadBody` in
  favor of `GrpcClientBuilder.drainRequestPayloadBody(boolean)`,
- Deprecated `HttpReporter.Builder.disableSpanBatching` in favor of
  `HttpReporter.Builder.spansBatchingEnabled(boolean)`,
- Deprecated `HttpServerBuilder.disableDrainingRequestPayloadBody` in
  favor of `HttpServerBuilder.drainRequestPayloadBody(boolean)`,
- Deprecated `SingleAddressHttpClientBuilder.disableHostHeaderFallback`
  in favor of
  `SingleAddressHttpClientBuilder.hostHeaderFallback(boolean)`.

Result:

More consistent builders' APIs.
@bondolo bondolo added the API PR with API changes (New or Deprecated) label Aug 27, 2021
Copy link
Member

@Scottmitch Scottmitch left a comment

Choose a reason for hiding this comment

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

lgtm after javadoc fix and rebase

Copy link
Member

@idelpivnitskiy idelpivnitskiy left a comment

Choose a reason for hiding this comment

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

Last comments than LGTM:

*/
public GrpcClientBuilder<U, R> hostHeaderFallback(boolean enable) {
throw new UnsupportedOperationException("Setting automatic host header fallback using this method" +
" is not yet supported.");
Copy link
Member

Choose a reason for hiding this comment

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

In the other PR @bondolo used getClass().getSimpleName(): https://github.com/apple/servicetalk/pull/1781/files#diff-fa20d1d978b59de34bb9649cc6cc21ba5321886ccaa29636bbc285eea14eb07aR332
Consider using getClass().getName() moving forward. It will help users understand who they should contact if this method is not implemented.

@chemicL chemicL force-pushed the builders-api-consistency branch from 527af0a to 4598764 Compare September 10, 2021 12:03
@chemicL chemicL merged commit 5f30630 into apple:main Sep 10, 2021
chemicL pushed a commit to chemicL/servicetalk that referenced this pull request Sep 10, 2021
Deprecate one-way boolean settings on builders

Motivation:

Some builder APIs allow disabling some feature without the option to
enable it. To keep the builders' APIs consistent all boolean settings
should accept a flag that can trigger the feature to on or off
configuration. This change deprecates the undesired methods and adds
methods that accept a boolean.

Modifications:

- Deprecated `GrpcClientBuilder.disableHostHeaderFallback` in favor of
  `GrpcClientBuilder.hostHeaderFallback(boolean)`,
- Deprecated `GrpcClientBuilder.disableDrainingRequestPayloadBody` in
  favor of `GrpcClientBuilder.drainRequestPayloadBody(boolean)`,
- Deprecated `HttpReporter.Builder.disableSpanBatching` in favor of
  `HttpReporter.Builder.spansBatchingEnabled(boolean)`,
- Deprecated `HttpServerBuilder.disableDrainingRequestPayloadBody` in
  favor of `HttpServerBuilder.drainRequestPayloadBody(boolean)`,
- Deprecated `SingleAddressHttpClientBuilder.disableHostHeaderFallback`
  in favor of
  `SingleAddressHttpClientBuilder.hostHeaderFallback(boolean)`.

Result:

More consistent builders' APIs.
chemicL pushed a commit that referenced this pull request Sep 13, 2021
Deprecate one-way boolean settings on builders

Motivation:

Some builder APIs allow disabling some feature without the option to
enable it. To keep the builders' APIs consistent all boolean settings
should accept a flag that can trigger the feature to on or off
configuration. This change deprecates the undesired methods and adds
methods that accept a boolean.

Modifications:

- Deprecated `GrpcClientBuilder.disableHostHeaderFallback` in favor of
  `GrpcClientBuilder.hostHeaderFallback(boolean)`,
- Deprecated `GrpcClientBuilder.disableDrainingRequestPayloadBody` in
  favor of `GrpcClientBuilder.drainRequestPayloadBody(boolean)`,
- Deprecated `HttpReporter.Builder.disableSpanBatching` in favor of
  `HttpReporter.Builder.spansBatchingEnabled(boolean)`,
- Deprecated `HttpServerBuilder.disableDrainingRequestPayloadBody` in
  favor of `HttpServerBuilder.drainRequestPayloadBody(boolean)`,
- Deprecated `SingleAddressHttpClientBuilder.disableHostHeaderFallback`
  in favor of
  `SingleAddressHttpClientBuilder.hostHeaderFallback(boolean)`.

Result:

More consistent builders' APIs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API PR with API changes (New or Deprecated)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants