本文整理汇总了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;
}
示例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;
}
示例3: getAttributes
@Override
public Attributes getAttributes() {
if (stream != null) {
return stream.getAttributes();
}
return Attributes.EMPTY;
}
示例4: getAttributes
@Override
public final Attributes getAttributes() {
if (state.winningSubstream != null) {
return state.winningSubstream.stream.getAttributes();
}
return Attributes.EMPTY;
}
示例5: getAttributes
@Override
public Attributes getAttributes() {
// TODO(zhangkun83): fill channel security attributes
return Attributes.EMPTY;
}
示例6: getAttributes
@Override
public Attributes getAttributes() {
return Attributes.EMPTY;
}
示例7: transportReady
@Override
public Attributes transportReady(Attributes attributes) {
return Attributes.EMPTY;
}
示例8: getAttributes
@Override public Attributes getAttributes() {
return Attributes.EMPTY;
}
示例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);
}
示例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;
}