Class InProcessChannelBuilder
- java.lang.Object
-
- io.grpc.ManagedChannelBuilder<T>
-
- io.grpc.ForwardingChannelBuilder2<InProcessChannelBuilder>
-
- io.grpc.inprocess.InProcessChannelBuilder
-
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1783") public final class InProcessChannelBuilder extends io.grpc.ForwardingChannelBuilder2<InProcessChannelBuilder>Builder for a channel that issues in-process requests. Clients identify the in-process server by its name.The channel is intended to be fully-featured, high performance, and useful in testing.
For usage examples, see
InProcessServerBuilder.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description InProcessChannelBuilderassumedMessageSize(long assumedMessageSize)Assumes RPC messages are the specified size.protected io.grpc.ManagedChannelBuilder<?>delegate()static InProcessChannelBuilderforAddress(String name, int port)Always fails.static InProcessChannelBuilderforAddress(SocketAddress address)Create a channel builder that will connect to the server referenced by the given address.static InProcessChannelBuilderforName(String name)Create a channel builder that will connect to the server with the given name.static InProcessChannelBuilderforTarget(String target)Create a channel builder that will connect to the server referenced by the given target URI.InProcessChannelBuilderkeepAliveTime(long keepAliveTime, TimeUnit timeUnit)Does nothing.InProcessChannelBuilderkeepAliveTimeout(long keepAliveTimeout, TimeUnit timeUnit)Does nothing.InProcessChannelBuilderkeepAliveWithoutCalls(boolean enable)Does nothing.InProcessChannelBuildermaxInboundMessageSize(int max)InProcessChannelBuildermaxInboundMetadataSize(int bytes)Sets the maximum size of metadata allowed to be received.InProcessChannelBuilderpropagateCauseWithStatus(boolean enable)Sets whether to include the cause with the status that is propagated forward from the InProcessTransport.InProcessChannelBuilderscheduledExecutorService(ScheduledExecutorService scheduledExecutorService)Provides a custom scheduled executor service.InProcessChannelBuilderusePlaintext()Does nothing.InProcessChannelBuilderuseTransportSecurity()Does nothing.-
Methods inherited from class io.grpc.ForwardingChannelBuilder2
addMetricSink, addTransportFilter, build, compressorRegistry, decompressorRegistry, defaultLoadBalancingPolicy, defaultServiceConfig, directExecutor, disableRetry, disableServiceConfigLookUp, enableRetry, executor, idleTimeout, intercept, intercept, interceptWithTarget, maxHedgedAttempts, maxRetryAttempts, maxTraceEvents, nameResolverFactory, offloadExecutor, overrideAuthority, perRpcBufferLimit, proxyDetector, retryBufferSize, setBinaryLog, setNameResolverArg, toString, userAgent
-
-
-
-
Method Detail
-
forName
public static InProcessChannelBuilder forName(String name)
Create a channel builder that will connect to the server with the given name.- Parameters:
name- the identity of the server to connect to- Returns:
- a new builder
-
forTarget
public static InProcessChannelBuilder forTarget(String target)
Create a channel builder that will connect to the server referenced by the given target URI. Only intended for use with a custom name resolver.- Parameters:
target- the identity of the server to connect to- Returns:
- a new builder
-
forAddress
public static InProcessChannelBuilder forAddress(SocketAddress address)
Create a channel builder that will connect to the server referenced by the given address.- Parameters:
address- the address of the server to connect to- Returns:
- a new builder
-
forAddress
public static InProcessChannelBuilder forAddress(String name, int port)
Always fails. CallforName(java.lang.String)instead.
-
delegate
@Internal protected io.grpc.ManagedChannelBuilder<?> delegate()
- Specified by:
delegatein classio.grpc.ForwardingChannelBuilder2<InProcessChannelBuilder>
-
maxInboundMessageSize
public InProcessChannelBuilder maxInboundMessageSize(int max)
- Overrides:
maxInboundMessageSizein classio.grpc.ForwardingChannelBuilder2<InProcessChannelBuilder>
-
useTransportSecurity
public InProcessChannelBuilder useTransportSecurity()
Does nothing.- Overrides:
useTransportSecurityin classio.grpc.ForwardingChannelBuilder2<InProcessChannelBuilder>
-
usePlaintext
public InProcessChannelBuilder usePlaintext()
Does nothing.- Overrides:
usePlaintextin classio.grpc.ForwardingChannelBuilder2<InProcessChannelBuilder>
-
keepAliveTime
public InProcessChannelBuilder keepAliveTime(long keepAliveTime, TimeUnit timeUnit)
Does nothing.- Overrides:
keepAliveTimein classio.grpc.ForwardingChannelBuilder2<InProcessChannelBuilder>
-
keepAliveTimeout
public InProcessChannelBuilder keepAliveTimeout(long keepAliveTimeout, TimeUnit timeUnit)
Does nothing.- Overrides:
keepAliveTimeoutin classio.grpc.ForwardingChannelBuilder2<InProcessChannelBuilder>
-
keepAliveWithoutCalls
public InProcessChannelBuilder keepAliveWithoutCalls(boolean enable)
Does nothing.- Overrides:
keepAliveWithoutCallsin classio.grpc.ForwardingChannelBuilder2<InProcessChannelBuilder>
-
scheduledExecutorService
public InProcessChannelBuilder scheduledExecutorService(ScheduledExecutorService scheduledExecutorService)
Provides a custom scheduled executor service.It's an optional parameter. If the user has not provided a scheduled executor service when the channel is built, the builder will use a static cached thread pool.
- Returns:
- this
- Since:
- 1.11.0
-
maxInboundMetadataSize
public InProcessChannelBuilder maxInboundMetadataSize(int bytes)
Sets the maximum size of metadata allowed to be received.Integer.MAX_VALUEdisables the enforcement. Defaults to no limit (Integer.MAX_VALUE).There is potential for performance penalty when this setting is enabled, as the Metadata must actually be serialized. Since the current implementation of Metadata pre-serializes, it's currently negligible. But Metadata is free to change its implementation.
- Overrides:
maxInboundMetadataSizein classio.grpc.ForwardingChannelBuilder2<InProcessChannelBuilder>- Parameters:
bytes- the maximum size of received metadata- Returns:
- this
- Throws:
IllegalArgumentException- if bytes is non-positive- Since:
- 1.17.0
-
propagateCauseWithStatus
public InProcessChannelBuilder propagateCauseWithStatus(boolean enable)
Sets whether to include the cause with the status that is propagated forward from the InProcessTransport. This was added to make debugging failing tests easier by showing the cause of the status.By default, this is set to false. A default value of false maintains consistency with other transports which strip causal information from the status to avoid leaking information to untrusted clients, and to avoid sharing language-specific information with the client. For the in-process implementation, this is not a concern.
- Parameters:
enable- whether to include cause in status- Returns:
- this
-
assumedMessageSize
public InProcessChannelBuilder assumedMessageSize(long assumedMessageSize)
Assumes RPC messages are the specified size. This avoids serializing messages for metrics and retry memory tracking. This can dramatically improve performance when accurate message sizes are not needed and if nothing else needs the serialized message.- Parameters:
assumedMessageSize- length of InProcess transport's messageSize.- Returns:
- this
- Throws:
IllegalArgumentException- if assumedMessageSize is negative.
-
-