Search in sources :

Example 6 with ThreadFactoryImpl

use of org.apache.rocketmq.common.ThreadFactoryImpl in project rocketmq-rocketmq-all-4.1.0-incubating by lirenzuo.

the class FiltersrvController method initialize.

public boolean initialize() {
    MixAll.printObjectProperties(log, this.filtersrvConfig);
    this.remotingServer = new NettyRemotingServer(this.nettyServerConfig);
    this.remotingExecutor = Executors.newFixedThreadPool(nettyServerConfig.getServerWorkerThreads(), new ThreadFactoryImpl("RemotingExecutorThread_"));
    this.registerProcessor();
    this.scheduledExecutorService.scheduleAtFixedRate(new Runnable() {

        @Override
        public void run() {
            FiltersrvController.this.registerFilterServerToBroker();
        }
    }, 3, 10, TimeUnit.SECONDS);
    this.defaultMQPullConsumer.setBrokerSuspendMaxTimeMillis(this.defaultMQPullConsumer.getBrokerSuspendMaxTimeMillis() - 1000);
    this.defaultMQPullConsumer.setConsumerTimeoutMillisWhenSuspend(this.defaultMQPullConsumer.getConsumerTimeoutMillisWhenSuspend() - 1000);
    this.defaultMQPullConsumer.setNamesrvAddr(this.filtersrvConfig.getNamesrvAddr());
    this.defaultMQPullConsumer.setInstanceName(String.valueOf(UtilAll.getPid()));
    return true;
}
Also used : NettyRemotingServer(org.apache.rocketmq.remoting.netty.NettyRemotingServer) ThreadFactoryImpl(org.apache.rocketmq.common.ThreadFactoryImpl)

Example 7 with ThreadFactoryImpl

use of org.apache.rocketmq.common.ThreadFactoryImpl in project rocketmq-rocketmq-all-4.1.0-incubating by lirenzuo.

the class NamesrvController method initialize.

public boolean initialize() {
    // 加载KV配置
    this.kvConfigManager.load();
    // 初始化通信层
    // brokerHousekeepingService 接收Broker连接事件
    this.remotingServer = new NettyRemotingServer(this.nettyServerConfig, this.brokerHousekeepingService);
    // 初始化固定线程池
    this.remotingExecutor = Executors.newFixedThreadPool(nettyServerConfig.getServerWorkerThreads(), new ThreadFactoryImpl("RemotingExecutorThread_"));
    // 注册接收到请求之后具体的处理
    this.registerProcessor();
    // 增加定时任务
    this.scheduledExecutorService.scheduleAtFixedRate(new Runnable() {

        @Override
        public void run() {
            NamesrvController.this.routeInfoManager.scanNotActiveBroker();
        }
    }, 5, 10, // 每隔10s扫描broker,维护当前存活的Broker信息
    TimeUnit.SECONDS);
    this.scheduledExecutorService.scheduleAtFixedRate(new Runnable() {

        @Override
        public void run() {
            NamesrvController.this.kvConfigManager.printAllPeriodically();
        }
    }, 1, 10, // 每隔10s打印KVConfig信息。
    TimeUnit.MINUTES);
    return true;
}
Also used : NettyRemotingServer(org.apache.rocketmq.remoting.netty.NettyRemotingServer) ThreadFactoryImpl(org.apache.rocketmq.common.ThreadFactoryImpl)

Example 8 with ThreadFactoryImpl

use of org.apache.rocketmq.common.ThreadFactoryImpl in project rocketmq by apache.

the class FiltersrvController method initialize.

public boolean initialize() {
    MixAll.printObjectProperties(log, this.filtersrvConfig);
    this.remotingServer = new NettyRemotingServer(this.nettyServerConfig);
    this.remotingExecutor = Executors.newFixedThreadPool(nettyServerConfig.getServerWorkerThreads(), new ThreadFactoryImpl("RemotingExecutorThread_"));
    this.registerProcessor();
    this.scheduledExecutorService.scheduleAtFixedRate(new Runnable() {

        @Override
        public void run() {
            FiltersrvController.this.registerFilterServerToBroker();
        }
    }, 3, 10, TimeUnit.SECONDS);
    this.defaultMQPullConsumer.setBrokerSuspendMaxTimeMillis(this.defaultMQPullConsumer.getBrokerSuspendMaxTimeMillis() - 1000);
    this.defaultMQPullConsumer.setConsumerTimeoutMillisWhenSuspend(this.defaultMQPullConsumer.getConsumerTimeoutMillisWhenSuspend() - 1000);
    this.defaultMQPullConsumer.setNamesrvAddr(this.filtersrvConfig.getNamesrvAddr());
    this.defaultMQPullConsumer.setInstanceName(String.valueOf(UtilAll.getPid()));
    return true;
}
Also used : NettyRemotingServer(org.apache.rocketmq.remoting.netty.NettyRemotingServer) ThreadFactoryImpl(org.apache.rocketmq.common.ThreadFactoryImpl)

Aggregations

ThreadFactoryImpl (org.apache.rocketmq.common.ThreadFactoryImpl)8 NettyRemotingServer (org.apache.rocketmq.remoting.netty.NettyRemotingServer)6 IOException (java.io.IOException)2 ScheduledThreadPoolExecutor (java.util.concurrent.ScheduledThreadPoolExecutor)2 ThreadPoolExecutor (java.util.concurrent.ThreadPoolExecutor)2 CommitLogDispatcherCalcBitMap (org.apache.rocketmq.broker.filter.CommitLogDispatcherCalcBitMap)2 BrokerFixedThreadPoolExecutor (org.apache.rocketmq.broker.latency.BrokerFixedThreadPoolExecutor)2 MessageStorePluginContext (org.apache.rocketmq.broker.plugin.MessageStorePluginContext)2 NettyServerConfig (org.apache.rocketmq.remoting.netty.NettyServerConfig)2 DefaultMessageStore (org.apache.rocketmq.store.DefaultMessageStore)2 BrokerStats (org.apache.rocketmq.store.stats.BrokerStats)2