Class NettyChannelBuilder.NettyTransportFactory
java.lang.Object
io.grpc.netty.NettyChannelBuilder.NettyTransportFactory
- All Implemented Interfaces:
ClientTransportFactory, Closeable, AutoCloseable
- Enclosing class:
NettyChannelBuilder
private static final class NettyChannelBuilder.NettyTransportFactory
extends Object
implements ClientTransportFactory
Creates Netty transports. Exposed for internal use, as it should be private.
-
Nested Class Summary
Nested classes/interfaces inherited from interface ClientTransportFactory
ClientTransportFactory.ClientTransportOptions, ClientTransportFactory.SwapChannelCredentialsResult -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final booleanprivate final io.netty.channel.ChannelFactory<? extends io.netty.channel.Channel> private final Map<io.netty.channel.ChannelOption<?>, ?> private booleanprivate final intprivate final io.netty.channel.EventLoopGroupprivate final ObjectPool<? extends io.netty.channel.EventLoopGroup> private final AtomicBackoffprivate final longprivate final longprivate final booleanprivate final NettyChannelBuilder.LocalSocketPickerprivate final intprivate final intprivate final ProtocolNegotiatorprivate final Class<? extends SocketAddress> private final TransportTracer.Factoryprivate final boolean -
Constructor Summary
ConstructorsConstructorDescriptionNettyTransportFactory(ProtocolNegotiator protocolNegotiator, io.netty.channel.ChannelFactory<? extends io.netty.channel.Channel> channelFactory, Map<io.netty.channel.ChannelOption<?>, ?> channelOptions, ObjectPool<? extends io.netty.channel.EventLoopGroup> groupPool, boolean autoFlowControl, int flowControlWindow, int maxMessageSize, int maxHeaderListSize, long keepAliveTimeNanos, long keepAliveTimeoutNanos, boolean keepAliveWithoutCalls, TransportTracer.Factory transportTracerFactory, NettyChannelBuilder.LocalSocketPicker localSocketPicker, boolean useGetForSafeMethods, Class<? extends SocketAddress> transportSocketType) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Releases any resources.Returns an executor for scheduling provided by the transport.Collection<Class<? extends SocketAddress>> Returns theSocketAddresstypes this transport supports.newClientTransport(SocketAddress serverAddress, ClientTransportFactory.ClientTransportOptions options, ChannelLogger channelLogger) Creates an unstarted transport for exclusive use.swapChannelCredentials(ChannelCredentials channelCreds) Swaps to a new ChannelCredentials with all other settings unchanged.
-
Field Details
-
protocolNegotiator
-
channelFactory
private final io.netty.channel.ChannelFactory<? extends io.netty.channel.Channel> channelFactory -
channelOptions
-
groupPool
-
group
private final io.netty.channel.EventLoopGroup group -
autoFlowControl
private final boolean autoFlowControl -
flowControlWindow
private final int flowControlWindow -
maxMessageSize
private final int maxMessageSize -
maxHeaderListSize
private final int maxHeaderListSize -
keepAliveTimeNanos
private final long keepAliveTimeNanos -
keepAliveBackoff
-
keepAliveTimeoutNanos
private final long keepAliveTimeoutNanos -
keepAliveWithoutCalls
private final boolean keepAliveWithoutCalls -
transportTracerFactory
-
localSocketPicker
-
useGetForSafeMethods
private final boolean useGetForSafeMethods -
closed
private boolean closed -
transportSocketType
-
-
Constructor Details
-
NettyTransportFactory
NettyTransportFactory(ProtocolNegotiator protocolNegotiator, io.netty.channel.ChannelFactory<? extends io.netty.channel.Channel> channelFactory, Map<io.netty.channel.ChannelOption<?>, ?> channelOptions, ObjectPool<? extends io.netty.channel.EventLoopGroup> groupPool, boolean autoFlowControl, int flowControlWindow, int maxMessageSize, int maxHeaderListSize, long keepAliveTimeNanos, long keepAliveTimeoutNanos, boolean keepAliveWithoutCalls, TransportTracer.Factory transportTracerFactory, NettyChannelBuilder.LocalSocketPicker localSocketPicker, boolean useGetForSafeMethods, Class<? extends SocketAddress> transportSocketType)
-
-
Method Details
-
newClientTransport
public ConnectionClientTransport newClientTransport(SocketAddress serverAddress, ClientTransportFactory.ClientTransportOptions options, ChannelLogger channelLogger) Description copied from interface:ClientTransportFactoryCreates an unstarted transport for exclusive use. Ownership ofoptionsis passed to the callee; the caller should not reuse or read from the options after this method is called.- Specified by:
newClientTransportin interfaceClientTransportFactory- Parameters:
serverAddress- the address that the transport is connected tooptions- additional configurationchannelLogger- logger for the transport.
-
getScheduledExecutorService
Description copied from interface:ClientTransportFactoryReturns 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.
- Specified by:
getScheduledExecutorServicein interfaceClientTransportFactory
-
swapChannelCredentials
public ClientTransportFactory.SwapChannelCredentialsResult swapChannelCredentials(ChannelCredentials channelCreds) Description copied from interface:ClientTransportFactorySwaps to a new ChannelCredentials with all other settings unchanged. Returns null if the ChannelCredentials is not supported by the current ClientTransportFactory settings.- Specified by:
swapChannelCredentialsin interfaceClientTransportFactory
-
close
public void close()Description copied from interface:ClientTransportFactoryReleases any resources.After this method has been called, it's no longer valid to call
ClientTransportFactory.newClientTransport(SocketAddress, ClientTransportFactory.ClientTransportOptions, ChannelLogger). No guarantees about thread-safety are made.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceClientTransportFactory- Specified by:
closein interfaceCloseable
-
getSupportedSocketAddressTypes
Description copied from interface:ClientTransportFactoryReturns theSocketAddresstypes this transport supports.- Specified by:
getSupportedSocketAddressTypesin interfaceClientTransportFactory
-