MCPcopy Create free account
hub / github.com/diyhi/bbs / run

Method run

src/main/java/cms/component/topic/HotTopicComponent.java:203–229  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

201
202 pool.execute(new Runnable(){
203 public void run() {
204 while (threadActivity) { //如果系统关闭,则不再运行
205 try {
206 List<Long> data = new ArrayList<Long>();
207
208 //每次到1000条数据才进行入库,或者等待1分钟,没达到1000条也继续入库
209 drain(uniqueQueue, data, 1000, 10, TimeUnit.MINUTES);//第三个参数:数量; 第四个参数:时间; 第五个参数:时间单位
210
211 for(Long l: data){
212 uniqueQueue.deleteUnique(l);//删除唯一标记
213 }
214
215 saveHotTopic(data);
216
217 } catch (InterruptedException e) {
218 // e.printStackTrace();
219 if (threadActivity && logger.isErrorEnabled()) {
220 logger.error("热门话题消费队列中断异常",e);
221 }
222 } catch (Exception e) {
223 // e.printStackTrace();
224 if (logger.isErrorEnabled()) {
225 logger.error("热门话题消费队列错误",e);
226 }
227 }
228 }
229 }});
230 }
231
232

Callers 1

mainMethod · 0.45

Calls 3

drainMethod · 0.95
saveHotTopicMethod · 0.95
deleteUniqueMethod · 0.80

Tested by

no test coverage detected