当前位置: 首页>>代码示例>>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;未经允许,请勿转载。