io.grpc.ServerStreamTracer.Factory源码实例Demo

类io.grpc.ServerStreamTracer.Factory源码实例Demo

下面列出了io.grpc.ServerStreamTracer.Factory 类实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

@Test
public void scheduledExecutorService_default() {
  InProcessServerBuilder builder = InProcessServerBuilder.forName("foo");
  InProcessServer server = builder.buildTransportServer(new ArrayList<Factory>());

  ObjectPool<ScheduledExecutorService> scheduledExecutorServicePool =
      server.getScheduledExecutorServicePool();
  ObjectPool<ScheduledExecutorService> expectedPool =
      SharedResourcePool.forResource(TIMER_SERVICE);

  ScheduledExecutorService expected = expectedPool.getObject();
  ScheduledExecutorService actual = scheduledExecutorServicePool.getObject();
  assertSame(expected, actual);

  expectedPool.returnObject(expected);
  scheduledExecutorServicePool.returnObject(actual);
}
 
@Test
public void scheduledExecutorService_custom() {
  InProcessServerBuilder builder = InProcessServerBuilder.forName("foo");
  ScheduledExecutorService scheduledExecutorService =
      new FakeClock().getScheduledExecutorService();

  InProcessServerBuilder builder1 = builder.scheduledExecutorService(scheduledExecutorService);
  assertSame(builder, builder1);

  InProcessServer server = builder1.buildTransportServer(new ArrayList<Factory>());
  ObjectPool<ScheduledExecutorService> scheduledExecutorServicePool =
      server.getScheduledExecutorServicePool();

  assertSame(scheduledExecutorService, scheduledExecutorServicePool.getObject());

  scheduledExecutorServicePool.returnObject(scheduledExecutorService);
}
 
源代码3 项目: grpc-java   文件: InProcessServerBuilderTest.java
@Test
public void scheduledExecutorService_default() {
  InProcessServerBuilder builder = InProcessServerBuilder.forName("foo");
  InProcessServer server =
      Iterables.getOnlyElement(builder.buildTransportServers(new ArrayList<Factory>()));

  ObjectPool<ScheduledExecutorService> scheduledExecutorServicePool =
      server.getScheduledExecutorServicePool();
  ObjectPool<ScheduledExecutorService> expectedPool =
      SharedResourcePool.forResource(TIMER_SERVICE);

  ScheduledExecutorService expected = expectedPool.getObject();
  ScheduledExecutorService actual = scheduledExecutorServicePool.getObject();
  assertSame(expected, actual);

  expectedPool.returnObject(expected);
  scheduledExecutorServicePool.returnObject(actual);
}
 
源代码4 项目: grpc-java   文件: InProcessServerBuilderTest.java
@Test
public void scheduledExecutorService_custom() {
  InProcessServerBuilder builder = InProcessServerBuilder.forName("foo");
  ScheduledExecutorService scheduledExecutorService =
      new FakeClock().getScheduledExecutorService();

  InProcessServerBuilder builder1 = builder.scheduledExecutorService(scheduledExecutorService);
  assertSame(builder, builder1);

  InProcessServer server =
      Iterables.getOnlyElement(builder1.buildTransportServers(new ArrayList<Factory>()));
  ObjectPool<ScheduledExecutorService> scheduledExecutorServicePool =
      server.getScheduledExecutorServicePool();

  assertSame(scheduledExecutorService, scheduledExecutorServicePool.getObject());

  scheduledExecutorServicePool.returnObject(scheduledExecutorService);
}
 
源代码5 项目: grpc-java   文件: NettyServerBuilderTest.java
@Test
public void createMultipleServers() {
  builder.addListenAddress(new InetSocketAddress(8081));
  List<NettyServer> servers = builder.buildTransportServers(ImmutableList.<Factory>of());

  Truth.assertThat(servers).hasSize(2);
}
 
源代码6 项目: grpc-nebula-java   文件: AltsServerBuilder.java
/** {@inheritDoc} */
@Override
public AltsServerBuilder addStreamTracerFactory(Factory factory) {
  delegate.addStreamTracerFactory(factory);
  return this;
}
 
源代码7 项目: dropwizard-grpc   文件: DropwizardServerBuilder.java
@Override
public DropwizardServerBuilder addStreamTracerFactory(final Factory factory) {
    origin.addStreamTracerFactory(factory);
    return this;
}
 
源代码8 项目: grpc-java   文件: AltsServerBuilder.java
/** {@inheritDoc} */
@Override
public AltsServerBuilder addStreamTracerFactory(Factory factory) {
  delegate.addStreamTracerFactory(factory);
  return this;
}
 
源代码评论
动弹
沙发等你来抢
 类所在包
 类方法
 同包方法