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


Java SharedResourceHolder.release方法代码示例

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


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

示例1: shutdown

import io.grpc.internal.SharedResourceHolder; //导入方法依赖的package包/类
@Override
public final synchronized void shutdown() {
    if (shutdown) {
        return;
    }
    shutdown = true;

    if (resolutionTask != null) {
        resolutionTask.cancel(false);
        resolutionTask = null;
    }

    if (timerService != null) {
        timerService = SharedResourceHolder.release(timerServiceResource, timerService);
    }

    if (executor != null) {
        executor = SharedResourceHolder.release(executorResource, executor);
    }
}
 
开发者ID:indeedeng-alpha,项目名称:indeed-grpc-java,代码行数:21,代码来源:ConsulNameResolver.java

示例2: deallocate

import io.grpc.internal.SharedResourceHolder; //导入方法依赖的package包/类
@Override
protected void deallocate() {
  try {
    if (usingSharedBossGroup && bossGroup != null) {
      SharedResourceHolder.release(Utils.DEFAULT_BOSS_EVENT_LOOP_GROUP, bossGroup);
    }
  } finally {
    bossGroup = null;
    try {
      if (usingSharedWorkerGroup && workerGroup != null) {
        SharedResourceHolder.release(Utils.DEFAULT_WORKER_EVENT_LOOP_GROUP, workerGroup);
      }
    } finally {
      workerGroup = null;
    }
  }
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:18,代码来源:NettyServer.java

示例3: shutdown

import io.grpc.internal.SharedResourceHolder; //导入方法依赖的package包/类
@Override
public void shutdown() {
  if (shutdown) {
    return;
  }
  shutdown = true;

  synchronized (lock) {
    if (executor != null) {
      executor = SharedResourceHolder.release(GrpcUtil.SHARED_CHANNEL_EXECUTOR, executor);
    }
  }
}
 
开发者ID:coreos,项目名称:jetcd,代码行数:14,代码来源:SmartNameResolver.java

示例4: stopIfNecessary

import io.grpc.internal.SharedResourceHolder; //导入方法依赖的package包/类
/**
 * When the transport is in goAway state, we should stop it once all active streams finish.
 */
@GuardedBy("lock")
private void stopIfNecessary() {
  if (!(goAwayStatus != null && streams.isEmpty() && pendingStreams.isEmpty())) {
    return;
  }
  if (stopped) {
    return;
  }
  stopped = true;

  if (keepAliveManager != null) {
    keepAliveManager.onTransportTermination();
    // KeepAliveManager should stop using the scheduler after onTransportTermination gets called.
    scheduler = SharedResourceHolder.release(TIMER_SERVICE, scheduler);
  }

  if (ping != null) {
    ping.failed(getPingFailure());
    ping = null;
  }

  if (!goAwaySent) {
    // Send GOAWAY with lastGoodStreamId of 0, since we don't expect any server-initiated
    // streams. The GOAWAY is part of graceful shutdown.
    goAwaySent = true;
    frameWriter.goAway(0, ErrorCode.NO_ERROR, new byte[0]);
  }

  // We will close the underlying socket in the writing thread to break out the reader
  // thread, which will close the frameReader and notify the listener.
  frameWriter.close();
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:36,代码来源:OkHttpClientTransport.java

示例5: close

import io.grpc.internal.SharedResourceHolder; //导入方法依赖的package包/类
@Override
public void close() {
  if (closed) {
    return;
  }
  closed = true;
  SharedResourceHolder.release(GrpcUtil.TIMER_SERVICE, timeoutService);

  if (usingSharedExecutor) {
    SharedResourceHolder.release(SHARED_EXECUTOR, (ExecutorService) executor);
  }
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:13,代码来源:OkHttpChannelBuilder.java

示例6: close

import io.grpc.internal.SharedResourceHolder; //导入方法依赖的package包/类
@Override
public void close() {
  if (closed) {
    return;
  }
  closed = true;

  if (usingSharedGroup) {
    SharedResourceHolder.release(Utils.DEFAULT_WORKER_EVENT_LOOP_GROUP, group);
  }
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:12,代码来源:NettyChannelBuilder.java

示例7: close

import io.grpc.internal.SharedResourceHolder; //导入方法依赖的package包/类
@Override
public void close() {
  if (closed) {
    return;
  }
  closed = true;
  SharedResourceHolder.release(GrpcUtil.TIMER_SERVICE, timerService);
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:9,代码来源:InProcessChannelBuilder.java

示例8: close

import io.grpc.internal.SharedResourceHolder; //导入方法依赖的package包/类
@Override
public void close() {
  SharedResourceHolder.release(GrpcUtil.TIMER_SERVICE, timeoutService);
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:5,代码来源:CronetChannelBuilder.java


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