@InternalExtensionOnly public class FixedTransportChannelProvider extends Object implements TransportChannelProvider
| Modifier and Type | Method and Description |
|---|---|
static FixedTransportChannelProvider |
create(TransportChannel transportChannel)
Creates a FixedTransportChannelProvider.
|
TransportChannel |
getTransportChannel()
Provides a Transport, which could either be a new instance for every call, or the same
instance, depending on the implementation.
|
String |
getTransportName()
The name of the transport.
|
boolean |
needsEndpoint()
True if the TransportProvider has no endpoint set.
|
boolean |
needsExecutor()
True if the TransportProvider needs an executor.
|
boolean |
needsHeaders()
True if the TransportProvider has no headers provided.
|
boolean |
shouldAutoClose()
Indicates whether the TransportChannel should be closed by the containing client class.
|
TransportChannelProvider |
withEndpoint(String endpoint)
Sets the endpoint to use when constructing a new
TransportChannel. |
FixedTransportChannelProvider |
withExecutor(ScheduledExecutorService executor)
Sets the executor to use when constructing a new
TransportChannel.. |
FixedTransportChannelProvider |
withHeaders(Map<String,String> headers)
Sets the headers to use when constructing a new
TransportChannel.. |
public boolean shouldAutoClose()
TransportChannelProvidershouldAutoClose in interface TransportChannelProviderpublic boolean needsExecutor()
TransportChannelProviderneedsExecutor in interface TransportChannelProviderpublic FixedTransportChannelProvider withExecutor(ScheduledExecutorService executor)
TransportChannelProviderTransportChannel..
This method should only be called if TransportChannelProvider.needsExecutor() returns true.
withExecutor in interface TransportChannelProvider@BetaApi(value="The surface for customizing headers is not stable yet and may change in the future.") public boolean needsHeaders()
TransportChannelProviderneedsHeaders in interface TransportChannelProvider@BetaApi(value="The surface for customizing headers is not stable yet and may change in the future.") public FixedTransportChannelProvider withHeaders(Map<String,String> headers)
TransportChannelProviderTransportChannel..
This method should only be called if TransportChannelProvider.needsHeaders() returns true.
withHeaders in interface TransportChannelProviderpublic boolean needsEndpoint()
TransportChannelProviderneedsEndpoint in interface TransportChannelProviderpublic TransportChannelProvider withEndpoint(String endpoint)
TransportChannelProviderTransportChannel.
This method should only be called if TransportChannelProvider.needsEndpoint() returns true.
withEndpoint in interface TransportChannelProviderpublic TransportChannel getTransportChannel() throws IOException
TransportChannelProviderIf TransportChannelProvider.needsExecutor() is true, then TransportChannelProvider.withExecutor(ScheduledExecutorService)
needs to be called first to provide an executor.
If TransportChannelProvider.needsHeaders() is true, then TransportChannelProvider.withHeaders(Map) needs to be called first
to provide headers.
if TransportChannelProvider.needsEndpoint() is true, then TransportChannelProvider.withEndpoint(String) needs to be called
first to provide an endpoint.
getTransportChannel in interface TransportChannelProviderIOExceptionpublic String getTransportName()
TransportChannelProviderThis string can be used for identifying transports for switching logic.
getTransportName in interface TransportChannelProviderpublic static FixedTransportChannelProvider create(TransportChannel transportChannel)