Package io.grpc.internal
Interface ClientTransportFactory
-
- All Superinterfaces:
java.lang.AutoCloseable
,java.io.Closeable
- All Known Implementing Classes:
CallCredentialsApplyingTransportFactory
,InProcessChannelBuilder.InProcessClientTransportFactory
,NettyChannelBuilder.NettyTransportFactory
public interface ClientTransportFactory extends java.io.Closeable
Pre-configured factory for creatingConnectionClientTransport
instances.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
ClientTransportFactory.ClientTransportOptions
static class
ClientTransportFactory.SwapChannelCredentialsResult
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
close()
Releases any resources.java.util.concurrent.ScheduledExecutorService
getScheduledExecutorService()
Returns an executor for scheduling provided by the transport.java.util.Collection<java.lang.Class<? extends java.net.SocketAddress>>
getSupportedSocketAddressTypes()
Returns theSocketAddress
types this transport supports.ConnectionClientTransport
newClientTransport(java.net.SocketAddress serverAddress, ClientTransportFactory.ClientTransportOptions options, ChannelLogger channelLogger)
Creates an unstarted transport for exclusive use.ClientTransportFactory.SwapChannelCredentialsResult
swapChannelCredentials(ChannelCredentials channelCreds)
Swaps to a new ChannelCredentials with all other settings unchanged.
-
-
-
Method Detail
-
newClientTransport
ConnectionClientTransport newClientTransport(java.net.SocketAddress serverAddress, ClientTransportFactory.ClientTransportOptions options, ChannelLogger channelLogger)
Creates an unstarted transport for exclusive use. Ownership ofoptions
is passed to the callee; the caller should not reuse or read from the options after this method is called.- Parameters:
serverAddress
- the address that the transport is connected tooptions
- additional configurationchannelLogger
- logger for the transport.
-
getScheduledExecutorService
java.util.concurrent.ScheduledExecutorService getScheduledExecutorService()
Returns an executor for scheduling provided by the transport. The service should be configured to allow cancelled scheduled runnables to be GCed.The executor should not be used after the factory has been closed. The caller should ensure any outstanding tasks are cancelled before the factory is closed. However, it is a known issue that ClientCallImpl may use this executor after close, so implementations should not go out of their way to prevent usage.
-
swapChannelCredentials
@CheckReturnValue @Nullable ClientTransportFactory.SwapChannelCredentialsResult swapChannelCredentials(ChannelCredentials channelCreds)
Swaps to a new ChannelCredentials with all other settings unchanged. Returns null if the ChannelCredentials is not supported by the current ClientTransportFactory settings.
-
close
void close()
Releases any resources.After this method has been called, it's no longer valid to call
newClientTransport(java.net.SocketAddress, io.grpc.internal.ClientTransportFactory.ClientTransportOptions, io.grpc.ChannelLogger)
. No guarantees about thread-safety are made.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
-
getSupportedSocketAddressTypes
java.util.Collection<java.lang.Class<? extends java.net.SocketAddress>> getSupportedSocketAddressTypes()
Returns theSocketAddress
types this transport supports.
-
-