public RemotingCommand invoke()

in impl/src/main/java/org/apache/rocketmq/remoting/impl/netty/NettyRemotingClient.java [139:165]


    public RemotingCommand invoke(final String address, final RemotingCommand request, final long timeoutMillis) {
        request.trafficType(TrafficType.REQUEST_SYNC);

        Channel channel = this.clientChannelManager.createIfAbsent(address);
        if (channel != null && channel.isActive()) {
            try {
                return this.invokeWithInterceptor(channel, request, timeoutMillis);

            } catch (RemotingTimeoutException e) {
                if (this.clientConfig.isClientCloseSocketIfTimeout()) {
                    LOG.warn("invoke: timeout, so close the socket {} ms, {}", timeoutMillis, address);
                    this.clientChannelManager.closeChannel(address, channel);
                }

                LOG.warn("invoke: wait response timeout<{}ms> exception, so close the channel[{}]", timeoutMillis, address);
                throw e;
            } finally {
                if (this.clientConfig.isClientShortConnectionEnable()) {
                    this.clientChannelManager.closeChannel(address, channel);
                }
            }
        } else {
            this.clientChannelManager.closeChannel(address, channel);
            throw new RemotingConnectFailureException(address);
        }

    }