}
void waitChannelReady(long cachedSize, long sleepMs) {
long begin = System.currentTimeMillis();
boolean changeThreadhold = false;
IntervalCheck oneSecond = new IntervalCheck();
IntervalCheck timeoutIntervalCheck = new IntervalCheck();
timeoutIntervalCheck.setInterval(timeoutSecond);
while (isChannelReady() == null) {
long now = System.currentTimeMillis();
long delt = now - begin;
if (oneSecond.check() == true) {
LOG.warn(
"Target server {} is unavailable, pending {}, bufferSize {}, block sending {}ms",
name, pendings.get(), cachedSize, delt);
}
if (timeoutIntervalCheck.check() == true) {
if (messageBatchRef.get() != null) {
LOG.warn(
"Target server {} is unavailable, wait too much time, throw timeout message",
name);
messageBatchRef.set(null);