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


Java SharedResourceHolder.get方法代码示例

本文整理汇总了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;
  }
}
 
开发者ID:saturnism,项目名称:grpc-java-by-example,代码行数:27,代码来源:KubernetesNameResolver.java

示例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();
}
 
开发者ID:indeedeng-alpha,项目名称:indeed-grpc-java,代码行数:9,代码来源:ConsulNameResolver.java

示例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();
  }
}
 
开发者ID:coreos,项目名称:jetcd,代码行数:10,代码来源:SmartNameResolver.java

示例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;
  }
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:30,代码来源:OkHttpChannelBuilder.java

示例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);
  }
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:9,代码来源:NettyServer.java

示例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;
  }
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:32,代码来源:NettyChannelBuilder.java


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