本文整理汇总了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);
}
}
示例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;
}
}
}
示例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);
}
}
}
示例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();
}
示例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);
}
}
示例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);
}
}
示例7: close
import io.grpc.internal.SharedResourceHolder; //导入方法依赖的package包/类
@Override
public void close() {
if (closed) {
return;
}
closed = true;
SharedResourceHolder.release(GrpcUtil.TIMER_SERVICE, timerService);
}
示例8: close
import io.grpc.internal.SharedResourceHolder; //导入方法依赖的package包/类
@Override
public void close() {
SharedResourceHolder.release(GrpcUtil.TIMER_SERVICE, timeoutService);
}