當前位置: 首頁>>代碼示例>>Java>>正文


Java RemotingSysResponseCode類代碼示例

本文整理匯總了Java中org.apache.rocketmq.remoting.protocol.RemotingSysResponseCode的典型用法代碼示例。如果您正苦於以下問題:Java RemotingSysResponseCode類的具體用法?Java RemotingSysResponseCode怎麽用?Java RemotingSysResponseCode使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


RemotingSysResponseCode類屬於org.apache.rocketmq.remoting.protocol包,在下文中一共展示了RemotingSysResponseCode類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: cleanExpiredRequest

import org.apache.rocketmq.remoting.protocol.RemotingSysResponseCode; //導入依賴的package包/類
private void cleanExpiredRequest() {
    while (this.brokerController.getMessageStore().isOSPageCacheBusy()) {
        try {
            if (!this.brokerController.getSendThreadPoolQueue().isEmpty()) {
                final Runnable runnable = this.brokerController.getSendThreadPoolQueue().poll(0, TimeUnit.SECONDS);
                if (null == runnable) {
                    break;
                }

                final RequestTask rt = castRunnable(runnable);
                rt.returnResponse(RemotingSysResponseCode.SYSTEM_BUSY, String.format("[PCBUSY_CLEAN_QUEUE]broker busy, start flow control for a while, period in queue: %sms, size of queue: %d", System.currentTimeMillis() - rt.getCreateTimestamp(), this.brokerController.getSendThreadPoolQueue().size()));
            } else {
                break;
            }
        } catch (Throwable ignored) {
        }
    }

    cleanExpiredRequestInQueue(this.brokerController.getSendThreadPoolQueue(),
        this.brokerController.getBrokerConfig().getWaitTimeMillsInSendQueue());

    cleanExpiredRequestInQueue(this.brokerController.getPullThreadPoolQueue(),
        this.brokerController.getBrokerConfig().getWaitTimeMillsInPullQueue());
}
 
開發者ID:apache,項目名稱:rocketmq,代碼行數:25,代碼來源:BrokerFastFailure.java

示例2: cleanExpiredRequestInQueue

import org.apache.rocketmq.remoting.protocol.RemotingSysResponseCode; //導入依賴的package包/類
void cleanExpiredRequestInQueue(final BlockingQueue<Runnable> blockingQueue, final long maxWaitTimeMillsInQueue) {
    while (true) {
        try {
            if (!blockingQueue.isEmpty()) {
                final Runnable runnable = blockingQueue.peek();
                if (null == runnable) {
                    break;
                }
                final RequestTask rt = castRunnable(runnable);
                if (rt == null || rt.isStopRun()) {
                    break;
                }

                final long behind = System.currentTimeMillis() - rt.getCreateTimestamp();
                if (behind >= maxWaitTimeMillsInQueue) {
                    if (blockingQueue.remove(runnable)) {
                        rt.setStopRun(true);
                        rt.returnResponse(RemotingSysResponseCode.SYSTEM_BUSY, String.format("[TIMEOUT_CLEAN_QUEUE]broker busy, start flow control for a while, period in queue: %sms, size of queue: %d", behind, blockingQueue.size()));
                    }
                } else {
                    break;
                }
            } else {
                break;
            }
        } catch (Throwable ignored) {
        }
    }
}
 
開發者ID:apache,項目名稱:rocketmq,代碼行數:30,代碼來源:BrokerFastFailure.java


注:本文中的org.apache.rocketmq.remoting.protocol.RemotingSysResponseCode類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。