Class InstantiatingHttpJsonChannelProvider (2.7.1)

publicfinalclass InstantiatingHttpJsonChannelProviderimplementsTransportChannelProvider

InstantiatingHttpJsonChannelProvider is a TransportChannelProvider which constructs a ManagedHttpJsonChannel with a number of configured inputs every time getChannel(...) is called. These inputs include a port, a service address, and credentials.

The credentials can either be supplied directly (by providing a FixedCredentialsProvider to Builder.setCredentialsProvider()) or acquired implicitly from Application Default Credentials (by providing a GoogleCredentialsProvider to Builder.setCredentialsProvider()).

The client lib header and generator header values are used to form a value that goes into the http header of requests to the service.

Inheritance

java.lang.Object > InstantiatingHttpJsonChannelProvider

Methods

acceptsPoolSize()

publicbooleanacceptsPoolSize()

Reports whether this provider allows pool size customization.

Returns
Type Description

getEndpoint()

publicStringgetEndpoint()

The endpoint to be used for the channel.

Returns
Type Description

getTransportChannel()

publicTransportChannelgetTransportChannel()

Provides a Transport, which could either be a new instance for every call, or the same instance, depending on the implementation.

If #needsExecutor() is true, then #withExecutor(Executor) needs to be called first to provide an executor.

If #needsHeaders() is true, then #withHeaders(Map) needs to be called first to provide headers.

if #needsEndpoint() is true, then #withEndpoint(String) needs to be called first to provide an endpoint.

Returns
Type Description
Exceptions
Type Description

getTransportName()

publicStringgetTransportName()

The name of the transport.

This string can be used for identifying transports for switching logic.

Returns
Type Description

needsCredentials()

publicbooleanneedsCredentials()

True if credentials are needed before channel creation.

Returns
Type Description

needsEndpoint()

publicbooleanneedsEndpoint()

True if the TransportProvider has no endpoint set.

Returns
Type Description

needsExecutor() (deprecated)

publicbooleanneedsExecutor()

(deprecated) If executor is not set, this channel provider will create channels with default executor defined in ManagedHttpJsonChannel.

True if the TransportProvider needs an executor.
Returns
Type Description

needsHeaders()

publicbooleanneedsHeaders()

True if the TransportProvider has no headers provided.

Returns
Type Description

newBuilder()

publicstaticInstantiatingHttpJsonChannelProvider.BuildernewBuilder()
Returns
Type Description

shouldAutoClose()

publicbooleanshouldAutoClose()

Indicates whether the TransportChannel should be closed by the containing client class.

Returns
Type Description

toBuilder()

publicInstantiatingHttpJsonChannelProvider.BuildertoBuilder()
Returns
Type Description

withCredentials(Credentials credentials)

publicTransportChannelProviderwithCredentials(Credentialscredentials)

Sets the credentials that will be applied before channel creation.

Parameter
Name Description
credentials com.google.auth.Credentials
Returns
Type Description

withEndpoint(String endpoint)

publicTransportChannelProviderwithEndpoint(Stringendpoint)

Sets the endpoint to use when constructing a new TransportChannel.

This method should only be called if #needsEndpoint() returns true.

Parameter
Name Description
endpoint String
Returns
Type Description

withExecutor(Executor executor)

publicTransportChannelProviderwithExecutor(Executorexecutor)

Sets the executor to use when constructing a new TransportChannel.

Parameter
Name Description
executor Executor
Returns
Type Description

withExecutor(ScheduledExecutorService executor)

publicTransportChannelProviderwithExecutor(ScheduledExecutorServiceexecutor)
Parameter
Name Description
Returns
Type Description

withHeaders(Map<String,String> headers)

publicTransportChannelProviderwithHeaders(Map<String,String>headers)

Sets the headers to use when constructing a new TransportChannel.

This method should only be called if #needsHeaders() returns true.

Parameter
Name Description
headers Map<String,String>
Returns
Type Description

withPoolSize(int size)

publicTransportChannelProviderwithPoolSize(intsize)

Number of underlying transport channels to open. Calls will be load balanced across them.

Parameter
Name Description
size int
Returns
Type Description

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025年11月19日 UTC.