com.alibaba.rocketmq.store.stats.BrokerStatsManager Java Examples

The following examples show how to use com.alibaba.rocketmq.store.stats.BrokerStatsManager. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GetMessageResult.java    From reading-and-annotate-rocketmq-3.4.6 with GNU General Public License v3.0 5 votes vote down vote up
public void addMessage(final SelectMapedBufferResult mapedBuffer) {
    this.messageMapedList.add(mapedBuffer);
    this.messageBufferList.add(mapedBuffer.getByteBuffer());
    this.bufferTotalSize += mapedBuffer.getSize();
    this.msgCount4Commercial += (int) Math.ceil(
            mapedBuffer.getSize() / BrokerStatsManager.SIZE_PER_COUNT);
}
 
Example #2
Source File: DefaultMessageStore.java    From reading-and-annotate-rocketmq-3.4.6 with GNU General Public License v3.0 5 votes vote down vote up
public DefaultMessageStore(final MessageStoreConfig messageStoreConfig, final BrokerStatsManager brokerStatsManager,
        final MessageArrivingListener messageArrivingListener, final BrokerConfig brokerConfig) throws IOException {
    this.messageArrivingListener = messageArrivingListener;
    this.brokerConfig = brokerConfig;
    this.messageStoreConfig = messageStoreConfig;
    this.brokerStatsManager = brokerStatsManager;
    this.allocateMapedFileService = new AllocateMapedFileService(this);
    this.commitLog = new CommitLog(this);
    this.consumeQueueTable = new ConcurrentHashMap<String/* topic */, ConcurrentHashMap<Integer/* queueId */, ConsumeQueue>>(32);

    this.flushConsumeQueueService = new FlushConsumeQueueService();

    //磁盘超过水位进行清理
    this.cleanCommitLogService = new CleanCommitLogService();
    this.cleanConsumeQueueService = new CleanConsumeQueueService();

    this.storeStatsService = new StoreStatsService();
    this.indexService = new IndexService(this);
    this.haService = new HAService(this);

    //异步构建CQ和索引文件的服务。
    this.reputMessageService = new ReputMessageService();
    //延迟消息投递服务
    this.scheduleMessageService = new ScheduleMessageService(this);

    this.allocateMapedFileService.start();
    this.indexService.start();
}
 
Example #3
Source File: BrokerController.java    From RocketMQ-Master-analyze with Apache License 2.0 5 votes vote down vote up
public BrokerController(final BrokerConfig brokerConfig, final NettyServerConfig nettyServerConfig,
        final NettyClientConfig nettyClientConfig, final MessageStoreConfig messageStoreConfig) {
    this.brokerConfig = brokerConfig;
    this.nettyServerConfig = nettyServerConfig;
    this.nettyClientConfig = nettyClientConfig;
    this.messageStoreConfig = messageStoreConfig;
    this.consumerOffsetManager = new ConsumerOffsetManager(this);
    this.topicConfigManager = new TopicConfigManager(this);
    this.pullMessageProcessor = new PullMessageProcessor(this);
    this.pullRequestHoldService = new PullRequestHoldService(this);
    this.consumerIdsChangeListener = new DefaultConsumerIdsChangeListener(this);
    this.consumerManager = new ConsumerManager(this.consumerIdsChangeListener);
    this.producerManager = new ProducerManager();
    this.clientHousekeepingService = new ClientHousekeepingService(this);
    this.broker2Client = new Broker2Client(this);
    this.subscriptionGroupManager = new SubscriptionGroupManager(this);
    this.brokerOuterAPI = new BrokerOuterAPI(nettyClientConfig);
    this.filterServerManager = new FilterServerManager(this);

    if (this.brokerConfig.getNamesrvAddr() != null) {
        // 更新netty client 的nameserver地址
        this.brokerOuterAPI.updateNameServerAddressList(this.brokerConfig.getNamesrvAddr());
        log.info("user specfied name server address: {}", this.brokerConfig.getNamesrvAddr());
    }
    // 构造broker和broker slave 节点间数据同步的对象
    this.slaveSynchronize = new SlaveSynchronize(this);
    // 发送消息任务队列
    this.sendThreadPoolQueue =
            new LinkedBlockingQueue<Runnable>(this.brokerConfig.getSendThreadPoolQueueCapacity());
    // 拉取消息任务队列
    this.pullThreadPoolQueue =
            new LinkedBlockingQueue<Runnable>(this.brokerConfig.getPullThreadPoolQueueCapacity());
    // 初始化broker状态管理类
    this.brokerStatsManager = new BrokerStatsManager(this.brokerConfig.getBrokerClusterName());
    // 设置broker IP和端口
    this.setStoreHost(new InetSocketAddress(this.getBrokerConfig().getBrokerIP1(),
        this.getNettyServerConfig().getListenPort()));
}
 
Example #4
Source File: DefaultMessageStore.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
public DefaultMessageStore(final MessageStoreConfig messageStoreConfig, final BrokerStatsManager brokerStatsManager,
                           final MessageArrivingListener messageArrivingListener, final TransactionCheckExecuter transactionCheckExecuter,final BrokerConfig brokerConfig) throws IOException {
    this.messageArrivingListener = messageArrivingListener;
    this.transactionCheckExecuter = transactionCheckExecuter;
    this.brokerConfig = brokerConfig;
    this.messageStoreConfig = messageStoreConfig;
    this.brokerStatsManager = brokerStatsManager;
    this.allocateMapedFileService = new AllocateMapedFileService(this);
    this.commitLog = new CommitLog(this);
    this.consumeQueueTable = new ConcurrentHashMap<String/* topic */, ConcurrentHashMap<Integer/* queueId */, ConsumeQueue>>(32);

    this.flushConsumeQueueService = new FlushConsumeQueueService();
    this.cleanCommitLogService = new CleanCommitLogService();
    this.cleanConsumeQueueService = new CleanConsumeQueueService();
    this.storeStatsService = new StoreStatsService();
    this.indexService = new IndexService(this);
    this.haService = new HAService(this);
    this.transactionStateService = new TransactionStateService(this);

    this.reputMessageService = new ReputMessageService();

    this.scheduleMessageService = new ScheduleMessageService(this);


    this.allocateMapedFileService.start();

    this.indexService.start();
}
 
Example #5
Source File: GetMessageResult.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
public void addMessage(final SelectMapedBufferResult mapedBuffer) {
    this.messageMapedList.add(mapedBuffer);
    this.messageBufferList.add(mapedBuffer.getByteBuffer());
    this.bufferTotalSize += mapedBuffer.getSize();
    this.msgCount4Commercial += (int) Math.ceil(
            mapedBuffer.getSize() / BrokerStatsManager.SIZE_PER_COUNT);
}
 
Example #6
Source File: BrokerController.java    From reading-and-annotate-rocketmq-3.4.6 with GNU General Public License v3.0 5 votes vote down vote up
public BrokerController(//
        final BrokerConfig brokerConfig, //
        final NettyServerConfig nettyServerConfig, //
        final NettyClientConfig nettyClientConfig, //
        final MessageStoreConfig messageStoreConfig //
) {
    this.brokerConfig = brokerConfig;
    this.nettyServerConfig = nettyServerConfig;
    this.nettyClientConfig = nettyClientConfig;
    this.messageStoreConfig = messageStoreConfig;
    this.consumerOffsetManager = new ConsumerOffsetManager(this);
    this.topicConfigManager = new TopicConfigManager(this);
    this.pullMessageProcessor = new PullMessageProcessor(this);
    this.pullRequestHoldService = new PullRequestHoldService(this);
    this.messageArrivingListener = new NotifyMessageArrivingListener(this.pullRequestHoldService);
    this.consumerIdsChangeListener = new DefaultConsumerIdsChangeListener(this);
    this.consumerManager = new ConsumerManager(this.consumerIdsChangeListener);
    this.producerManager = new ProducerManager();
    this.clientHousekeepingService = new ClientHousekeepingService(this);
    this.broker2Client = new Broker2Client(this);
    this.subscriptionGroupManager = new SubscriptionGroupManager(this);
    this.brokerOuterAPI = new BrokerOuterAPI(nettyClientConfig);
    this.filterServerManager = new FilterServerManager(this);

    if (this.brokerConfig.getNamesrvAddr() != null) {
        this.brokerOuterAPI.updateNameServerAddressList(this.brokerConfig.getNamesrvAddr());
        log.info("user specfied name server address: {}", this.brokerConfig.getNamesrvAddr());
    }

    this.slaveSynchronize = new SlaveSynchronize(this);

    this.sendThreadPoolQueue = new LinkedBlockingQueue<Runnable>(this.brokerConfig.getSendThreadPoolQueueCapacity());

    this.pullThreadPoolQueue = new LinkedBlockingQueue<Runnable>(this.brokerConfig.getPullThreadPoolQueueCapacity());

    this.brokerStatsManager = new BrokerStatsManager(this.brokerConfig.getBrokerClusterName());
    this.setStoreHost(new InetSocketAddress(this.getBrokerConfig().getBrokerIP1(), this.getNettyServerConfig().getListenPort()));
}
 
Example #7
Source File: MessageStorePluginContext.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
public MessageStorePluginContext(MessageStoreConfig messageStoreConfig,
                                 BrokerStatsManager brokerStatsManager, MessageArrivingListener messageArrivingListener,
                                 BrokerConfig brokerConfig) {
    super();
    this.messageStoreConfig = messageStoreConfig;
    this.brokerStatsManager = brokerStatsManager;
    this.messageArrivingListener = messageArrivingListener;
    this.brokerConfig = brokerConfig;
}
 
Example #8
Source File: SendMessageContext.java    From rocketmq with Apache License 2.0 4 votes vote down vote up
public void setCommercialSendStats(final BrokerStatsManager.StatsType commercialSendStats) {
    this.commercialSendStats = commercialSendStats;
}
 
Example #9
Source File: DefaultMessageStore.java    From RocketMQ-Master-analyze with Apache License 2.0 4 votes vote down vote up
public BrokerStatsManager getBrokerStatsManager() {
    return brokerStatsManager;
}
 
Example #10
Source File: DefaultMessageStore.java    From RocketMQ-Master-analyze with Apache License 2.0 4 votes vote down vote up
public DefaultMessageStore(final MessageStoreConfig messageStoreConfig,
        final BrokerStatsManager brokerStatsManager) throws IOException {
    this.messageStoreConfig = messageStoreConfig;
    this.brokerStatsManager = brokerStatsManager;
    this.allocateMapedFileService = new AllocateMapedFileService();
    this.commitLog = new CommitLog(this);
    this.consumeQueueTable =
            new ConcurrentHashMap<String/* topic */, ConcurrentHashMap<Integer/* queueId */, ConsumeQueue>>(
                32);

    this.flushConsumeQueueService = new FlushConsumeQueueService();
    this.cleanCommitLogService = new CleanCommitLogService();
    this.cleanConsumeQueueService = new CleanConsumeQueueService();
    this.dispatchMessageService =
            new DispatchMessageService(this.messageStoreConfig.getPutMsgIndexHightWater());
    this.storeStatsService = new StoreStatsService();
    this.indexService = new IndexService(this);
    this.haService = new HAService(this);

    switch (this.messageStoreConfig.getBrokerRole()) {
    case SLAVE:
        this.reputMessageService = new ReputMessageService();
        // reputMessageService依赖scheduleMessageService做定时消息的恢复,确保储备数据一致
        this.scheduleMessageService = new ScheduleMessageService(this);
        break;
    case ASYNC_MASTER:
    case SYNC_MASTER:
        this.reputMessageService = null;
        this.scheduleMessageService = new ScheduleMessageService(this);
        break;
    default:
        this.reputMessageService = null;
        this.scheduleMessageService = null;
    }

    // load过程依赖此服务,所以提前启动
    this.allocateMapedFileService.start();
    this.dispatchMessageService.start();
    // 因为下面的recover会分发请求到索引服务,如果不启动,分发过程会被流控
    this.indexService.start();
}
 
Example #11
Source File: BrokerController.java    From RocketMQ-Master-analyze with Apache License 2.0 4 votes vote down vote up
public BrokerStatsManager getBrokerStatsManager() {
    return brokerStatsManager;
}
 
Example #12
Source File: DefaultMessageStore.java    From rocketmq with Apache License 2.0 4 votes vote down vote up
public BrokerStatsManager getBrokerStatsManager() {
    return brokerStatsManager;
}
 
Example #13
Source File: MessageStorePluginContext.java    From rocketmq with Apache License 2.0 4 votes vote down vote up
public BrokerStatsManager getBrokerStatsManager() {
    return brokerStatsManager;
}
 
Example #14
Source File: SendMessageContext.java    From rocketmq with Apache License 2.0 4 votes vote down vote up
public BrokerStatsManager.StatsType getCommercialSendStats() {
    return commercialSendStats;
}
 
Example #15
Source File: ConsumeMessageContext.java    From rocketmq with Apache License 2.0 4 votes vote down vote up
public void setCommercialRcvStats(final BrokerStatsManager.StatsType commercialRcvStats) {
    this.commercialRcvStats = commercialRcvStats;
}
 
Example #16
Source File: ConsumeMessageContext.java    From rocketmq with Apache License 2.0 4 votes vote down vote up
public BrokerStatsManager.StatsType getCommercialRcvStats() {
    return commercialRcvStats;
}
 
Example #17
Source File: BrokerController.java    From rocketmq with Apache License 2.0 4 votes vote down vote up
public BrokerStatsManager getBrokerStatsManager() {
    return brokerStatsManager;
}
 
Example #18
Source File: BrokerController.java    From rocketmq with Apache License 2.0 4 votes vote down vote up
public BrokerController(//
                        final BrokerConfig brokerConfig, //
                        final NettyServerConfig nettyServerConfig, //
                        final NettyClientConfig nettyClientConfig, //
                        final MessageStoreConfig messageStoreConfig //
) {
    this.brokerConfig = brokerConfig;
    this.nettyServerConfig = nettyServerConfig;
    this.nettyClientConfig = nettyClientConfig;
    this.messageStoreConfig = messageStoreConfig;
    this.consumerOffsetManager = new ConsumerOffsetManager(this);
    this.topicConfigManager = new TopicConfigManager(this);
    this.pullMessageProcessor = new PullMessageProcessor(this);
    this.pullRequestHoldService = new PullRequestHoldService(this);
    this.defaultTransactionCheckExecuter = new DefaultTransactionCheckExecuter(this);
    this.messageArrivingListener = new NotifyMessageArrivingListener(this.pullRequestHoldService);
    this.consumerIdsChangeListener = new DefaultConsumerIdsChangeListener(this);
    this.consumerManager = new ConsumerManager(this.consumerIdsChangeListener);
    this.producerManager = new ProducerManager();
    this.clientHousekeepingService = new ClientHousekeepingService(this);
    this.broker2Client = new Broker2Client(this);
    this.subscriptionGroupManager = new SubscriptionGroupManager(this);
    this.brokerOuterAPI = new BrokerOuterAPI(nettyClientConfig);
    this.filterServerManager = new FilterServerManager(this);

    if (this.brokerConfig.getNamesrvAddr() != null) {
        this.brokerOuterAPI.updateNameServerAddressList(this.brokerConfig.getNamesrvAddr());
        log.info("user specfied name server address: {}", this.brokerConfig.getNamesrvAddr());
    }

    this.slaveSynchronize = new SlaveSynchronize(this);

    this.sendThreadPoolQueue = new LinkedBlockingQueue<Runnable>(this.brokerConfig.getSendThreadPoolQueueCapacity());

    this.pullThreadPoolQueue = new LinkedBlockingQueue<Runnable>(this.brokerConfig.getPullThreadPoolQueueCapacity());

    this.brokerStatsManager = new BrokerStatsManager(this.brokerConfig.getBrokerClusterName());
    this.setStoreHost(new InetSocketAddress(this.getBrokerConfig().getBrokerIP1(), this.getNettyServerConfig().getListenPort()));

    this.brokerFastFailure = new BrokerFastFailure(this);
}
 
Example #19
Source File: DefaultMessageStore.java    From reading-and-annotate-rocketmq-3.4.6 with GNU General Public License v3.0 4 votes vote down vote up
public BrokerStatsManager getBrokerStatsManager() {
    return brokerStatsManager;
}
 
Example #20
Source File: BrokerController.java    From reading-and-annotate-rocketmq-3.4.6 with GNU General Public License v3.0 4 votes vote down vote up
public BrokerStatsManager getBrokerStatsManager() {
    return brokerStatsManager;
}