当前位置: 首页>>代码示例>>Java>>正文


Java ServerStreamTracer类代码示例

本文整理汇总了Java中io.grpc.ServerStreamTracer的典型用法代码示例。如果您正苦于以下问题:Java ServerStreamTracer类的具体用法?Java ServerStreamTracer怎么用?Java ServerStreamTracer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ServerStreamTracer类属于io.grpc包,在下文中一共展示了ServerStreamTracer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildTransportServer

import io.grpc.ServerStreamTracer; //导入依赖的package包/类
@Override
@CheckReturnValue
protected NettyServer buildTransportServer(
    List<ServerStreamTracer.Factory> streamTracerFactories) {
  ProtocolNegotiator negotiator = protocolNegotiator;
  if (negotiator == null) {
    negotiator = sslContext != null ? ProtocolNegotiators.serverTls(sslContext) :
            ProtocolNegotiators.serverPlaintext();
  }

  return new NettyServer(
      address, channelType, channelOptions, bossEventLoopGroup, workerEventLoopGroup,
      negotiator, streamTracerFactories, transportTracerFactory,
      maxConcurrentCallsPerConnection, flowControlWindow,
      maxMessageSize, maxHeaderListSize, keepAliveTimeInNanos, keepAliveTimeoutInNanos,
      maxConnectionIdleInNanos,
      maxConnectionAgeInNanos, maxConnectionAgeGraceInNanos,
      permitKeepAliveWithoutCalls, permitKeepAliveTimeInNanos);
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:20,代码来源:NettyServerBuilder.java

示例2: getPort_notStarted

import io.grpc.ServerStreamTracer; //导入依赖的package包/类
@Test
public void getPort_notStarted() throws Exception {
  InetSocketAddress addr = new InetSocketAddress(0);
  NettyServer ns = new NettyServer(
      addr,
      NioServerSocketChannel.class,
      new HashMap<ChannelOption<?>, Object>(),
      null, // no boss group
      null, // no event group
      new ProtocolNegotiators.PlaintextNegotiator(),
      Collections.<ServerStreamTracer.Factory>emptyList(),
      TransportTracer.getDefaultFactory(),
      1, // ignore
      1, // ignore
      1, // ignore
      1, // ignore
      1, // ignore
      1, 1, // ignore
      1, 1, // ignore
      true, 0); // ignore

  assertThat(ns.getPort()).isEqualTo(-1);
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:24,代码来源:NettyServerTest.java

示例3: startServer

import io.grpc.ServerStreamTracer; //导入依赖的package包/类
private void startServer(int maxStreamsPerConnection, int maxHeaderListSize) throws IOException {
  server = new NettyServer(
      TestUtils.testServerAddress(0),
      NioServerSocketChannel.class,
      new HashMap<ChannelOption<?>, Object>(),
      group, group, negotiator,
      Collections.<ServerStreamTracer.Factory>emptyList(),
      TransportTracer.getDefaultFactory(),
      maxStreamsPerConnection,
      DEFAULT_WINDOW_SIZE, DEFAULT_MAX_MESSAGE_SIZE, maxHeaderListSize,
      DEFAULT_SERVER_KEEPALIVE_TIME_NANOS, DEFAULT_SERVER_KEEPALIVE_TIMEOUT_NANOS,
      MAX_CONNECTION_IDLE_NANOS_DISABLED,
      MAX_CONNECTION_AGE_NANOS_DISABLED, MAX_CONNECTION_AGE_GRACE_NANOS_INFINITE, true, 0);
  server.start(serverListener);
  address = TestUtils.testServerAddress(server.getPort());
  authority = GrpcUtil.authorityFromHostAndPort(address.getHostString(), address.getPort());
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:18,代码来源:NettyClientTransportTest.java

示例4: newServerStreamTracer

import io.grpc.ServerStreamTracer; //导入依赖的package包/类
@Override
public ServerStreamTracer newServerStreamTracer(String fullMethodName, Metadata headers) {
  TagContext parentCtx = headers.get(statsHeader);
  if (parentCtx == null) {
    parentCtx = tagger.empty();
  }
  parentCtx =
      tagger
          .toBuilder(parentCtx)
          .put(RpcMeasureConstants.RPC_METHOD, TagValue.create(fullMethodName))
          .build();
  return new ServerTracer(
      CensusStatsModule.this,
      fullMethodName,
      parentCtx,
      stopwatchSupplier,
      tagger,
      recordStartedRpcs,
      recordFinishedRpcs);
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:21,代码来源:CensusStatsModule.java

示例5: getTracerFactories

import io.grpc.ServerStreamTracer; //导入依赖的package包/类
@VisibleForTesting
final List<ServerStreamTracer.Factory> getTracerFactories() {
  ArrayList<ServerStreamTracer.Factory> tracerFactories =
      new ArrayList<ServerStreamTracer.Factory>();
  if (statsEnabled) {
    CensusStatsModule censusStats = this.censusStatsOverride;
    if (censusStats == null) {
      censusStats = new CensusStatsModule(GrpcUtil.STOPWATCH_SUPPLIER, true);
    }
    tracerFactories.add(
        censusStats.getServerTracerFactory(recordStartedRpcs, recordFinishedRpcs));
  }
  if (tracingEnabled) {
    CensusTracingModule censusTracing =
        new CensusTracingModule(Tracing.getTracer(),
            Tracing.getPropagationComponent().getBinaryFormat());
    tracerFactories.add(censusTracing.getServerTracerFactory());
  }
  tracerFactories.addAll(streamTracerFactories);
  return tracerFactories;
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:22,代码来源:AbstractServerImplBuilder.java

示例6: traceHeadersPropagateSpanContext

import io.grpc.ServerStreamTracer; //导入依赖的package包/类
@Test
public void traceHeadersPropagateSpanContext() throws Exception {
  CensusTracingModule.ClientCallTracer callTracer =
      censusTracing.newClientCallTracer(fakeClientParentSpan, method);
  Metadata headers = new Metadata();
  callTracer.newClientStreamTracer(CallOptions.DEFAULT, headers);

  verify(mockTracingPropagationHandler).toByteArray(same(fakeClientSpanContext));
  verifyNoMoreInteractions(mockTracingPropagationHandler);
  verify(tracer).spanBuilderWithExplicitParent(
      eq("Sent.package1.service2.method3"), same(fakeClientParentSpan));
  verify(spyClientSpanBuilder).setRecordEvents(eq(true));
  verifyNoMoreInteractions(tracer);
  assertTrue(headers.containsKey(censusTracing.tracingHeader));

  ServerStreamTracer serverTracer =
      censusTracing.getServerTracerFactory().newServerStreamTracer(
          method.getFullMethodName(), headers);
  verify(mockTracingPropagationHandler).fromByteArray(same(binarySpanContext));
  verify(tracer).spanBuilderWithRemoteParent(
      eq("Recv.package1.service2.method3"), same(spyClientSpan.getContext()));
  verify(spyServerSpanBuilder).setRecordEvents(eq(true));

  Context filteredContext = serverTracer.filterContext(Context.ROOT);
  assertSame(spyServerSpan, ContextUtils.CONTEXT_SPAN_KEY.get(filteredContext));
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:27,代码来源:CensusModulesTest.java

示例7: serverTracingSampledToLocalSpanStore

import io.grpc.ServerStreamTracer; //导入依赖的package包/类
@Test
public void serverTracingSampledToLocalSpanStore() {
  ServerStreamTracer.Factory tracerFactory = censusTracing.getServerTracerFactory();
  ServerStreamTracer serverStreamTracer =
      tracerFactory.newServerStreamTracer(sampledMethod.getFullMethodName(), new Metadata());

  serverStreamTracer.filterContext(Context.ROOT);

  serverStreamTracer.serverCallStarted(
      new ServerCallInfoImpl<String, String>(sampledMethod, Attributes.EMPTY, null));

  serverStreamTracer.streamClosed(Status.CANCELLED);

  verify(spyServerSpan).end(
      EndSpanOptions.builder()
          .setStatus(io.opencensus.trace.Status.CANCELLED)
          .setSampleToLocalSpanStore(true)
          .build());
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:20,代码来源:CensusModulesTest.java

示例8: newServer

import io.grpc.ServerStreamTracer; //导入依赖的package包/类
@Override
protected InternalServer newServer(List<ServerStreamTracer.Factory> streamTracerFactories) {
  return AccessProtectedHack.serverBuilderBuildTransportServer(
      NettyServerBuilder
        .forPort(0)
        .flowControlWindow(65 * 1024),
      streamTracerFactories,
      fakeClockTransportTracer);
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:10,代码来源:OkHttpTransportTest.java

示例9: serverBuilderBuildTransportServer

import io.grpc.ServerStreamTracer; //导入依赖的package包/类
public static InternalServer serverBuilderBuildTransportServer(
    AbstractServerImplBuilder<?> builder,
    List<ServerStreamTracer.Factory> streamTracerFactories,
    TransportTracer.Factory transportTracerFactory) {
  builder.transportTracerFactory = transportTracerFactory;
  return builder.buildTransportServer(streamTracerFactories);
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:8,代码来源:AccessProtectedHack.java

示例10: newServerStreamTracer

import io.grpc.ServerStreamTracer; //导入依赖的package包/类
@Override
public ServerStreamTracer newServerStreamTracer(String fullMethodName, Metadata headers) {
  ServerStreamTracerInfo.InteropServerStreamTracer tracer
      = new ServerStreamTracerInfo.InteropServerStreamTracer();
  serverStreamTracers.add(new ServerStreamTracerInfo(fullMethodName, tracer));
  return tracer;
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:8,代码来源:AbstractInteropTest.java

示例11: NettyServerTransport

import io.grpc.ServerStreamTracer; //导入依赖的package包/类
NettyServerTransport(
    Channel channel,
    ChannelPromise channelUnused,
    ProtocolNegotiator protocolNegotiator,
    List<ServerStreamTracer.Factory> streamTracerFactories,
    TransportTracer transportTracer,
    int maxStreams,
    int flowControlWindow,
    int maxMessageSize,
    int maxHeaderListSize,
    long keepAliveTimeInNanos,
    long keepAliveTimeoutInNanos,
    long maxConnectionIdleInNanos,
    long maxConnectionAgeInNanos,
    long maxConnectionAgeGraceInNanos,
    boolean permitKeepAliveWithoutCalls,
    long permitKeepAliveTimeInNanos) {
  this.channel = Preconditions.checkNotNull(channel, "channel");
  this.channelUnused = channelUnused;
  this.protocolNegotiator = Preconditions.checkNotNull(protocolNegotiator, "protocolNegotiator");
  this.streamTracerFactories =
      Preconditions.checkNotNull(streamTracerFactories, "streamTracerFactories");
  this.transportTracer = Preconditions.checkNotNull(transportTracer, "transportTracer");
  this.maxStreams = maxStreams;
  this.flowControlWindow = flowControlWindow;
  this.maxMessageSize = maxMessageSize;
  this.maxHeaderListSize = maxHeaderListSize;
  this.keepAliveTimeInNanos = keepAliveTimeInNanos;
  this.keepAliveTimeoutInNanos = keepAliveTimeoutInNanos;
  this.maxConnectionIdleInNanos = maxConnectionIdleInNanos;
  this.maxConnectionAgeInNanos = maxConnectionAgeInNanos;
  this.maxConnectionAgeGraceInNanos = maxConnectionAgeGraceInNanos;
  this.permitKeepAliveWithoutCalls = permitKeepAliveWithoutCalls;
  this.permitKeepAliveTimeInNanos = permitKeepAliveTimeInNanos;
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:36,代码来源:NettyServerTransport.java

示例12: NettyServer

import io.grpc.ServerStreamTracer; //导入依赖的package包/类
NettyServer(
    SocketAddress address, Class<? extends ServerChannel> channelType,
    Map<ChannelOption<?>, ?> channelOptions,
    @Nullable EventLoopGroup bossGroup, @Nullable EventLoopGroup workerGroup,
    ProtocolNegotiator protocolNegotiator, List<ServerStreamTracer.Factory> streamTracerFactories,
    TransportTracer.Factory transportTracerFactory,
    int maxStreamsPerConnection, int flowControlWindow, int maxMessageSize, int maxHeaderListSize,
    long keepAliveTimeInNanos, long keepAliveTimeoutInNanos,
    long maxConnectionIdleInNanos,
    long maxConnectionAgeInNanos, long maxConnectionAgeGraceInNanos,
    boolean permitKeepAliveWithoutCalls, long permitKeepAliveTimeInNanos) {
  this.address = address;
  this.channelType = checkNotNull(channelType, "channelType");
  checkNotNull(channelOptions, "channelOptions");
  this.channelOptions = new HashMap<ChannelOption<?>, Object>(channelOptions);
  this.bossGroup = bossGroup;
  this.workerGroup = workerGroup;
  this.protocolNegotiator = checkNotNull(protocolNegotiator, "protocolNegotiator");
  this.streamTracerFactories = checkNotNull(streamTracerFactories, "streamTracerFactories");
  this.usingSharedBossGroup = bossGroup == null;
  this.usingSharedWorkerGroup = workerGroup == null;
  this.transportTracerFactory = transportTracerFactory;
  this.maxStreamsPerConnection = maxStreamsPerConnection;
  this.flowControlWindow = flowControlWindow;
  this.maxMessageSize = maxMessageSize;
  this.maxHeaderListSize = maxHeaderListSize;
  this.keepAliveTimeInNanos = keepAliveTimeInNanos;
  this.keepAliveTimeoutInNanos = keepAliveTimeoutInNanos;
  this.maxConnectionIdleInNanos = maxConnectionIdleInNanos;
  this.maxConnectionAgeInNanos = maxConnectionAgeInNanos;
  this.maxConnectionAgeGraceInNanos = maxConnectionAgeGraceInNanos;
  this.permitKeepAliveWithoutCalls = permitKeepAliveWithoutCalls;
  this.permitKeepAliveTimeInNanos = permitKeepAliveTimeInNanos;
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:35,代码来源:NettyServer.java

示例13: getPort

import io.grpc.ServerStreamTracer; //导入依赖的package包/类
@Test
public void getPort() throws Exception {
  InetSocketAddress addr = new InetSocketAddress(0);
  NettyServer ns = new NettyServer(
      addr,
      NioServerSocketChannel.class,
      new HashMap<ChannelOption<?>, Object>(),
      null, // no boss group
      null, // no event group
      new ProtocolNegotiators.PlaintextNegotiator(),
      Collections.<ServerStreamTracer.Factory>emptyList(),
      TransportTracer.getDefaultFactory(),
      1, // ignore
      1, // ignore
      1, // ignore
      1, // ignore
      1, // ignore
      1, 1, // ignore
      1, 1, // ignore
      true, 0); // ignore
  ns.start(new ServerListener() {
    @Override
    public ServerTransportListener transportCreated(ServerTransport transport) {
      return null;
    }

    @Override
    public void serverShutdown() {}
  });

  // Check that we got an actual port.
  assertThat(ns.getPort()).isGreaterThan(0);

  // Cleanup
  ns.shutdown();
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:37,代码来源:NettyServerTest.java

示例14: newServer

import io.grpc.ServerStreamTracer; //导入依赖的package包/类
@Override
protected InternalServer newServer(List<ServerStreamTracer.Factory> streamTracerFactories) {
  return NettyServerBuilder
      .forPort(0)
      .flowControlWindow(65 * 1024)
      .setTransportTracerFactory(fakeClockTransportTracer)
      .buildTransportServer(streamTracerFactories);
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:9,代码来源:NettyTransportTest.java

示例15: InProcessServer

import io.grpc.ServerStreamTracer; //导入依赖的package包/类
@VisibleForTesting
InProcessServer(
    String name, ObjectPool<ScheduledExecutorService> schedulerPool,
    List<ServerStreamTracer.Factory> streamTracerFactories) {
  this.name = name;
  this.schedulerPool = schedulerPool;
  this.streamTracerFactories =
      Collections.unmodifiableList(checkNotNull(streamTracerFactories, "streamTracerFactories"));
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:10,代码来源:InProcessServer.java


注:本文中的io.grpc.ServerStreamTracer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。