本文整理匯總了Java中io.grpc.ManagedChannel.isShutdown方法的典型用法代碼示例。如果您正苦於以下問題:Java ManagedChannel.isShutdown方法的具體用法?Java ManagedChannel.isShutdown怎麽用?Java ManagedChannel.isShutdown使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類io.grpc.ManagedChannel
的用法示例。
在下文中一共展示了ManagedChannel.isShutdown方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onDestroy
import io.grpc.ManagedChannel; //導入方法依賴的package包/類
@Override
public void onDestroy() {
super.onDestroy();
mHandler.removeCallbacks(mFetchAccessTokenRunnable);
mHandler = null;
// Release the gRPC channel.
if (mApi != null) {
final ManagedChannel channel = (ManagedChannel) mApi.getChannel();
if (channel != null && !channel.isShutdown()) {
try {
channel.shutdown().awaitTermination(5, TimeUnit.SECONDS);
} catch (InterruptedException e) {
Log.e(TAG, "Error shutting down the gRPC channel.", e);
}
}
mApi = null;
}
}
示例2: shutDownChannel
import io.grpc.ManagedChannel; //導入方法依賴的package包/類
public static void shutDownChannel(HostInfo hostInfo)
{
ManagedChannel channel=serviceChannels.get(hostInfo);
try {
if(channel!=null&&!channel.isShutdown())
{
channel.shutdown().awaitTermination(5, TimeUnit.SECONDS);
}
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
finally {
serviceChannels.remove(hostInfo);
}
}
示例3: isChannelActive
import io.grpc.ManagedChannel; //導入方法依賴的package包/類
boolean isChannelActive() {
ManagedChannel lchannel = managedChannel;
return lchannel != null && !lchannel.isShutdown() && !lchannel.isTerminated();
}