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


Java Attributes.EMPTY属性代码示例

本文整理汇总了Java中io.grpc.Attributes.EMPTY属性的典型用法代码示例。如果您正苦于以下问题:Java Attributes.EMPTY属性的具体用法?Java Attributes.EMPTY怎么用?Java Attributes.EMPTY使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在io.grpc.Attributes的用法示例。


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

示例1: createStream

@Override
protected NettyServerStream createStream() {
  when(handler.getWriteQueue()).thenReturn(writeQueue);
  doAnswer(new Answer<Object>() {
    @Override
    public Object answer(InvocationOnMock invocation) throws Throwable {
      if (future.isDone()) {
        ((ChannelPromise) invocation.getArguments()[1]).setSuccess();
      }
      return null;
    }
  }).when(writeQueue).enqueue(any(QueuedCommand.class), any(ChannelPromise.class), anyBoolean());
  when(writeQueue.enqueue(any(QueuedCommand.class), anyBoolean())).thenReturn(future);
  StatsTraceContext statsTraceCtx = StatsTraceContext.NOOP;
  TransportTracer transportTracer = new TransportTracer();
  NettyServerStream.TransportState state = new NettyServerStream.TransportState(
      handler, channel.eventLoop(), http2Stream, DEFAULT_MAX_MESSAGE_SIZE, statsTraceCtx,
      transportTracer);
  NettyServerStream stream = new NettyServerStream(channel, state, Attributes.EMPTY,
      "test-authority", statsTraceCtx, transportTracer);
  stream.transportState().setListener(serverListener);
  state.onStreamAllocated();
  verify(serverListener, atLeastOnce()).onReady();
  verifyNoMoreInteractions(serverListener);
  return stream;
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:26,代码来源:NettyServerStreamTest.java

示例2: createResolvedServerAddresses

private static List<EquivalentAddressGroup> createResolvedServerAddresses(boolean ... isLb) {
  ArrayList<EquivalentAddressGroup> list = new ArrayList<EquivalentAddressGroup>();
  for (int i = 0; i < isLb.length; i++) {
    SocketAddress addr = new FakeSocketAddress("fake-address-" + i);
    EquivalentAddressGroup eag =
        new EquivalentAddressGroup(
            addr,
            isLb[i] ? lbAttributes(lbAuthority(i)) : Attributes.EMPTY);
    list.add(eag);
  }
  return list;
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:12,代码来源:GrpclbLoadBalancerTest.java

示例3: getAttributes

@Override
public Attributes getAttributes() {
  if (stream != null) {
    return stream.getAttributes();
  }
  return Attributes.EMPTY;
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:7,代码来源:ClientCallImpl.java

示例4: getAttributes

@Override
public final Attributes getAttributes() {
  if (state.winningSubstream != null) {
    return state.winningSubstream.stream.getAttributes();
  }
  return Attributes.EMPTY;
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:7,代码来源:RetriableStream.java

示例5: getAttributes

@Override
public Attributes getAttributes() {
  // TODO(zhangkun83): fill channel security attributes
  return Attributes.EMPTY;
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:5,代码来源:CronetClientTransport.java

示例6: getAttributes

@Override
public Attributes getAttributes() {
  return Attributes.EMPTY;
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:4,代码来源:CronetClientStream.java

示例7: transportReady

@Override
public Attributes transportReady(Attributes attributes) {
  return Attributes.EMPTY;
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:4,代码来源:NettyServerHandlerTest.java

示例8: getAttributes

@Override public Attributes getAttributes() {
  return Attributes.EMPTY;
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:3,代码来源:AbstractServerStream.java

示例9: setSubchannel

void setSubchannel(final InternalSubchannel subchannel) {
  log.log(Level.FINE, "[{0}] Created with [{1}]", new Object[] {this, subchannel});
  this.subchannel = subchannel;
  subchannelImpl = new AbstractSubchannel() {
      @Override
      public void shutdown() {
        subchannel.shutdown(Status.UNAVAILABLE.withDescription("OobChannel is shutdown"));
      }

      @Override
      ClientTransport obtainActiveTransport() {
        return subchannel.obtainActiveTransport();
      }

      @Override
      public void requestConnection() {
        subchannel.obtainActiveTransport();
      }

      @Override
      public EquivalentAddressGroup getAddresses() {
        return subchannel.getAddressGroup();
      }

      @Override
      public Attributes getAttributes() {
        return Attributes.EMPTY;
      }

      @Override
      public ListenableFuture<ChannelStats> getStats() {
        SettableFuture<ChannelStats> ret = SettableFuture.create();
        ChannelStats.Builder builder = new ChannelStats.Builder();
        subchannelCallsTracer.updateBuilder(builder);
        builder.setTarget(authority).setState(subchannel.getState());
        ret.set(builder.build());
        return ret;
      }
  };

  subchannelPicker = new SubchannelPicker() {
      final PickResult result = PickResult.withSubchannel(subchannelImpl);

      @Override
      public PickResult pickSubchannel(PickSubchannelArgs args) {
        return result;
      }
    };
  delayedTransport.reprocess(subchannelPicker);
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:50,代码来源:OobChannel.java

示例10: getNameResolverParams

/**
 * Subclasses can override this method to provide additional parameters to {@link
 * NameResolver.Factory#newNameResolver}. The default implementation returns {@link
 * Attributes#EMPTY}.
 */
protected Attributes getNameResolverParams() {
  return Attributes.EMPTY;
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:8,代码来源:AbstractManagedChannelImplBuilder.java


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