code: public void releaseManagedChannel(ChannelKey channelKey, long shutdownTimeoutMs) {
      boolean shutdownManagedChannel;
      try (LockResource lockShared = new LockResource(mLock.readLock())) {
        Verify.verify(mChannels.containsKey(channelKey));
        ManagedChannelReference channelRef = mChannels.get(channelKey);
        channelRef.dereference();
        shutdownManagedChannel = channelRef.getRefCount() <= 0;
        LOG.debug("Released managed channel for: {}. Ref-count: {}", channelKey,
            channelRef.getRefCount());
      }
      if (shutdownManagedChannel) {
        try (LockResource lockExclusive = new LockResource(mLock.writeLock())) {
          if (mChannels.containsKey(channelKey)) {
            ManagedChannelReference channelRef = mChannels.get(channelKey);
            if (channelRef.getRefCount() <= 0) {
              shutdownManagedChannel(channelKey, shutdownTimeoutMs);
            }
          }
        }
      }
    }
docs: Decreases the ref-count of the {@link ManagedChannel} for the given address.
  
  It shuts down and releases the {@link ManagedChannel} if reference count reaches zero.
  
  @param channelKey host address
  @param shutdownTimeoutMs shutdown timeout in milliseconds