本文整理汇总了Java中io.grpc.internal.SharedResourceHolder.get方法的典型用法代码示例。如果您正苦于以下问题:Java SharedResourceHolder.get方法的具体用法?Java SharedResourceHolder.get怎么用?Java SharedResourceHolder.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.grpc.internal.SharedResourceHolder
的用法示例。
在下文中一共展示了SharedResourceHolder.get方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: refresh
import io.grpc.internal.SharedResourceHolder; //导入方法依赖的package包/类
@Override
@GuardedBy("this")
public void refresh() {
if (refreshing) return;
try {
refreshing = true;
Endpoints endpoints = kubernetesClient.endpoints().inNamespace(namespace)
.withName(name)
.get();
if (endpoints == null) {
// Didn't find anything, retrying
ScheduledExecutorService timerService = SharedResourceHolder.get(timerServiceResource);
timerService.schedule(() -> {
refresh();
}, 30, TimeUnit.SECONDS);
return;
}
update(endpoints);
watch();
} finally {
refreshing = false;
}
}
示例2: start
import io.grpc.internal.SharedResourceHolder; //导入方法依赖的package包/类
@Override
public final synchronized void start(final Listener listener) {
checkState(this.listener == null, "ConsulNameResolver already started");
timerService = SharedResourceHolder.get(timerServiceResource);
executor = SharedResourceHolder.get(executorResource);
this.listener = checkNotNull(listener, "listener cannot be null");
resolve();
}
示例3: start
import io.grpc.internal.SharedResourceHolder; //导入方法依赖的package包/类
@Override
public void start(Listener listener) {
synchronized (lock) {
Preconditions.checkState(this.listener == null, "already started");
this.executor = SharedResourceHolder.get(GrpcUtil.SHARED_CHANNEL_EXECUTOR);
this.listener = Preconditions.checkNotNull(listener, "listener");
resolve();
}
}
示例4: OkHttpTransportFactory
import io.grpc.internal.SharedResourceHolder; //导入方法依赖的package包/类
private OkHttpTransportFactory(Executor executor,
@Nullable SSLSocketFactory socketFactory,
@Nullable HostnameVerifier hostnameVerifier,
ConnectionSpec connectionSpec,
int maxMessageSize,
boolean enableKeepAlive,
long keepAliveTimeNanos,
long keepAliveTimeoutNanos,
boolean keepAliveWithoutCalls,
TransportTracer.Factory transportTracerFactory) {
this.socketFactory = socketFactory;
this.hostnameVerifier = hostnameVerifier;
this.connectionSpec = connectionSpec;
this.maxMessageSize = maxMessageSize;
this.enableKeepAlive = enableKeepAlive;
this.keepAliveTimeNanos = new AtomicBackoff("keepalive time nanos", keepAliveTimeNanos);
this.keepAliveTimeoutNanos = keepAliveTimeoutNanos;
this.keepAliveWithoutCalls = keepAliveWithoutCalls;
usingSharedExecutor = executor == null;
this.transportTracerFactory =
Preconditions.checkNotNull(transportTracerFactory, "transportTracerFactory");
if (usingSharedExecutor) {
// The executor was unspecified, using the shared executor.
this.executor = SharedResourceHolder.get(SHARED_EXECUTOR);
} else {
this.executor = executor;
}
}
示例5: allocateSharedGroups
import io.grpc.internal.SharedResourceHolder; //导入方法依赖的package包/类
private void allocateSharedGroups() {
if (bossGroup == null) {
bossGroup = SharedResourceHolder.get(Utils.DEFAULT_BOSS_EVENT_LOOP_GROUP);
}
if (workerGroup == null) {
workerGroup = SharedResourceHolder.get(Utils.DEFAULT_WORKER_EVENT_LOOP_GROUP);
}
}
示例6: NettyTransportFactory
import io.grpc.internal.SharedResourceHolder; //导入方法依赖的package包/类
NettyTransportFactory(TransportCreationParamsFilterFactory transportCreationParamsFilterFactory,
Class<? extends Channel> channelType, Map<ChannelOption<?>, ?> channelOptions,
NegotiationType negotiationType, SslContext sslContext, EventLoopGroup group,
int flowControlWindow, int maxMessageSize, int maxHeaderListSize,
long keepAliveTimeNanos, long keepAliveTimeoutNanos, boolean keepAliveWithoutCalls,
TransportTracer transportTracer) {
this.channelType = channelType;
this.negotiationType = negotiationType;
this.channelOptions = new HashMap<ChannelOption<?>, Object>(channelOptions);
this.transportTracer = transportTracer;
if (transportCreationParamsFilterFactory == null) {
transportCreationParamsFilterFactory =
new DefaultNettyTransportCreationParamsFilterFactory(sslContext);
}
this.transportCreationParamsFilterFactory = transportCreationParamsFilterFactory;
this.flowControlWindow = flowControlWindow;
this.maxMessageSize = maxMessageSize;
this.maxHeaderListSize = maxHeaderListSize;
this.keepAliveTimeNanos = new AtomicBackoff("keepalive time nanos", keepAliveTimeNanos);
this.keepAliveTimeoutNanos = keepAliveTimeoutNanos;
this.keepAliveWithoutCalls = keepAliveWithoutCalls;
usingSharedGroup = group == null;
if (usingSharedGroup) {
// The group was unspecified, using the shared group.
this.group = SharedResourceHolder.get(Utils.DEFAULT_WORKER_EVENT_LOOP_GROUP);
} else {
this.group = group;
}
}