Skip to content

Commit

Permalink
Removed GrpcClientBuilder#MultiClientBuilder (apple#1809)
Browse files Browse the repository at this point in the history
Motivation:

`GrpcClientBuilder#MultiClientBuilder` was previously deprecated and is no longer necessary.

Modifications:

- Removed `GrpcClientBuilder#MultiClientBuilder`,
- Removed `GrpcClientBuilder#buildMulti` method.

Result:

Unnecessary means to create multiple `GrpcClient`s has been removed and
there is one way to build `GrpcClient`s.
  • Loading branch information
Dariusz Jedrzejczyk authored Sep 9, 2021
1 parent 29c2eee commit 74ac390
Showing 1 changed file with 0 additions and 77 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -386,38 +386,6 @@ public final GrpcClientBuilder<U, R> appendHttpClientFilter(Predicate<StreamingH
return clientFactory.newBlockingClientForCallFactory(newGrpcClientCallFactory());
}

/**
* Returns a {@link MultiClientBuilder} to be used to create multiple clients sharing the same underlying transport
* instance.
*
* @return A blocking <a href="https://www.grpc.io">gRPC</a> client.
* @deprecated Use {@link GrpcClientFactory#newClient(GrpcClientCallFactory)}
* or {@link GrpcClientFactory#newBlockingClient(GrpcClientCallFactory)}
* and provide a custom {@link GrpcClientCallFactory} instead.
*/
@Deprecated
public final MultiClientBuilder buildMulti() {
GrpcClientCallFactory callFactory = newGrpcClientCallFactory();
return new MultiClientBuilder() {
@Override
public <Client extends GrpcClient<?>,
Filter extends FilterableClient, FilterableClient extends FilterableGrpcClient,
FilterFactory extends GrpcClientFilterFactory<Filter, FilterableClient>> Client
build(final GrpcClientFactory<Client, ?, Filter, FilterableClient, FilterFactory> clientFactory) {
return clientFactory.newClient(callFactory);
}

@Override
public <BlockingClient extends BlockingGrpcClient<?>,
Filter extends FilterableClient, FilterableClient extends FilterableGrpcClient,
FilterFactory extends GrpcClientFilterFactory<Filter, FilterableClient>> BlockingClient
buildBlocking(
final GrpcClientFactory<?, BlockingClient, Filter, FilterableClient, FilterFactory> clientFactory) {
return clientFactory.newBlockingClient(callFactory);
}
};
}

/**
* Create a new {@link GrpcClientCallFactory}.
*
Expand Down Expand Up @@ -483,49 +451,4 @@ protected Single<StreamingHttpResponse> request(final StreamingHttpRequester del
private static GrpcStatusException toGrpcException(Throwable cause) {
return fromThrowable(cause).asException();
}

/**
* An interface to create multiple <a href="https://www.grpc.io">gRPC</a> clients sharing the
* same underlying transport instance.
* @deprecated Use {@link GrpcClientFactory#newClient(GrpcClientCallFactory)}
* or {@link GrpcClientFactory#newBlockingClient(GrpcClientCallFactory)}
* and provide a custom {@link GrpcClientCallFactory} instead.
*/
@Deprecated
public interface MultiClientBuilder {

/**
* Builds a <a href="https://www.grpc.io">gRPC</a> client.
*
* @param clientFactory {@link GrpcClientFactory} to use.
* @param <Client> <a href="https://www.grpc.io">gRPC</a> service that any client built
* from this factory represents.
* @param <Filter> Type for client filter
* @param <FilterableClient> Type of filterable client.
* @param <FilterFactory> Type of {@link GrpcClientFilterFactory}
*
* @return A <a href="https://www.grpc.io">gRPC</a> client.
*/
<Client extends GrpcClient<?>,
Filter extends FilterableClient, FilterableClient extends FilterableGrpcClient,
FilterFactory extends GrpcClientFilterFactory<Filter, FilterableClient>> Client
build(GrpcClientFactory<Client, ?, Filter, FilterableClient, FilterFactory> clientFactory);

/**
* Builds a blocking <a href="https://www.grpc.io">gRPC</a> client.
*
* @param clientFactory {@link GrpcClientFactory} to use.
* @param <BlockingClient> Blocking <a href="https://www.grpc.io">gRPC</a> service that
* any client built from this builder represents.
* @param <Filter> Type for client filter
* @param <FilterableClient> Type of filterable client.
* @param <FilterFactory> Type of {@link GrpcClientFilterFactory}
*
* @return A blocking <a href="https://www.grpc.io">gRPC</a> client.
*/
<BlockingClient extends BlockingGrpcClient<?>,
Filter extends FilterableClient, FilterableClient extends FilterableGrpcClient,
FilterFactory extends GrpcClientFilterFactory<Filter, FilterableClient>> BlockingClient
buildBlocking(GrpcClientFactory<?, BlockingClient, Filter, FilterableClient, FilterFactory> clientFactory);
}
}

0 comments on commit 74ac390

Please sign in to comment.