io.grpc.Internal Java Examples

The following examples show how to use io.grpc.Internal. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: NettyChannelBuilder.java    From grpc-nebula-java with Apache License 2.0 6 votes vote down vote up
@Override
@CheckReturnValue
@Internal
protected ClientTransportFactory buildTransportFactory() {
  ProtocolNegotiator negotiator;
  if (protocolNegotiatorFactory != null) {
    negotiator = protocolNegotiatorFactory.buildProtocolNegotiator();
  } else {
    SslContext localSslContext = sslContext;
    if (negotiationType == NegotiationType.TLS && localSslContext == null) {
      try {
        localSslContext = GrpcSslContexts.forClient().build();
      } catch (SSLException ex) {
        throw new RuntimeException(ex);
      }
    }
    negotiator = createProtocolNegotiatorByType(negotiationType, localSslContext);
  }
  return new NettyTransportFactory(
      negotiator, channelType, channelOptions,
      eventLoopGroup, flowControlWindow, maxInboundMessageSize(),
      maxHeaderListSize, keepAliveTimeNanos, keepAliveTimeoutNanos, keepAliveWithoutCalls,
      transportTracerFactory.create(), localSocketPicker);
}
 
Example #2
Source File: OkHttpChannelBuilder.java    From grpc-java with Apache License 2.0 6 votes vote down vote up
@Override
@Internal
protected final ClientTransportFactory buildTransportFactory() {
  boolean enableKeepAlive = keepAliveTimeNanos != KEEPALIVE_TIME_NANOS_DISABLED;
  return new OkHttpTransportFactory(
      transportExecutor,
      scheduledExecutorService,
      socketFactory,
      createSslSocketFactory(),
      hostnameVerifier,
      connectionSpec,
      maxInboundMessageSize(),
      enableKeepAlive,
      keepAliveTimeNanos,
      keepAliveTimeoutNanos,
      flowControlWindow,
      keepAliveWithoutCalls,
      maxInboundMetadataSize,
      transportTracerFactory,
      useGetForSafeMethods);
}
 
Example #3
Source File: InternalInProcess.java    From grpc-java with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a new InProcessTransport.
 *
 * <p>When started, the transport will be registered with the given
 * {@link ServerListener}.
 */
@Internal
public static ConnectionClientTransport createInProcessTransport(
    String name,
    int maxInboundMetadataSize,
    String authority,
    String userAgent,
    Attributes eagAttrs,
    ObjectPool<ScheduledExecutorService> serverSchedulerPool,
    List<ServerStreamTracer.Factory> serverStreamTracerFactories,
    ServerListener serverListener) {
  return new InProcessTransport(
      name,
      maxInboundMetadataSize,
      authority,
      userAgent,
      eagAttrs,
      serverSchedulerPool,
      serverStreamTracerFactories,
      serverListener);
}
 
Example #4
Source File: OkHttpChannelBuilder.java    From grpc-nebula-java with Apache License 2.0 5 votes vote down vote up
@Override
@Internal
protected final ClientTransportFactory buildTransportFactory() {
  boolean enableKeepAlive = keepAliveTimeNanos != KEEPALIVE_TIME_NANOS_DISABLED;
  return new OkHttpTransportFactory(transportExecutor, scheduledExecutorService,
      createSocketFactory(), hostnameVerifier, connectionSpec, maxInboundMessageSize(),
      enableKeepAlive, keepAliveTimeNanos, keepAliveTimeoutNanos, flowControlWindow,
      keepAliveWithoutCalls, maxInboundMetadataSize, transportTracerFactory);
}
 
Example #5
Source File: NettyChannelBuilder.java    From grpc-nebula-java with Apache License 2.0 5 votes vote down vote up
@Override
@CheckReturnValue
@Internal
protected String checkAuthority(String authority) {
  if (authorityChecker != null) {
    return authorityChecker.checkAuthority(authority);
  }
  return super.checkAuthority(authority);
}
 
Example #6
Source File: NettyChannelBuilder.java    From grpc-java with Apache License 2.0 5 votes vote down vote up
@Override
@CheckReturnValue
@Internal
protected ClientTransportFactory buildTransportFactory() {
  assertEventLoopAndChannelType();

  ProtocolNegotiator negotiator;
  if (protocolNegotiatorFactory != null) {
    negotiator = protocolNegotiatorFactory.buildProtocolNegotiator();
  } else {
    SslContext localSslContext = sslContext;
    if (negotiationType == NegotiationType.TLS && localSslContext == null) {
      try {
        localSslContext = GrpcSslContexts.forClient().build();
      } catch (SSLException ex) {
        throw new RuntimeException(ex);
      }
    }
    negotiator = createProtocolNegotiatorByType(negotiationType, localSslContext,
        this.getOffloadExecutorPool());
  }

  return new NettyTransportFactory(
      negotiator, channelFactory, channelOptions,
      eventLoopGroupPool, autoFlowControl, flowControlWindow, maxInboundMessageSize(),
      maxHeaderListSize, keepAliveTimeNanos, keepAliveTimeoutNanos, keepAliveWithoutCalls,
      transportTracerFactory, localSocketPicker, useGetForSafeMethods);
}
 
Example #7
Source File: NettyChannelBuilder.java    From grpc-java with Apache License 2.0 5 votes vote down vote up
@Override
@CheckReturnValue
@Internal
protected String checkAuthority(String authority) {
  if (authorityChecker != null) {
    return authorityChecker.checkAuthority(authority);
  }
  return super.checkAuthority(authority);
}
 
Example #8
Source File: InProcessChannelBuilder.java    From grpc-nebula-java with Apache License 2.0 4 votes vote down vote up
@Override
@Internal
protected ClientTransportFactory buildTransportFactory() {
  return new InProcessClientTransportFactory(
      name, scheduledExecutorService, maxInboundMetadataSize);
}
 
Example #9
Source File: InProcessChannelBuilder.java    From grpc-java with Apache License 2.0 4 votes vote down vote up
@Override
@Internal
protected ClientTransportFactory buildTransportFactory() {
  return new InProcessClientTransportFactory(
      name, scheduledExecutorService, maxInboundMetadataSize, transportIncludeStatusCause);
}
 
Example #10
Source File: AbstractServerImplBuilder.java    From grpc-nebula-java with Apache License 2.0 2 votes vote down vote up
/**
 * Children of AbstractServerBuilder should override this method to provide transport specific
 * information for the server.  This method is mean for Transport implementors and should not be
 * used by normal users.
 *
 * @param streamTracerFactories an immutable list of stream tracer factories
 */
@Internal
protected abstract io.grpc.internal.InternalServer buildTransportServer(
    List<ServerStreamTracer.Factory> streamTracerFactories);