设为首页 加入收藏

TOP

从中间件团队窃取了这个组件,见识到了编码能力的天花板!!(四)
2023-07-25 21:29:35 】 浏览:83
Tags:从中间 能力的 花板
;     * @param capacity 阻塞队列初始容量          * @param processor 回调接口          */         public WorkThread(String threadName, int queueSizeLimit, int period, int capacity, Processor<T> processor) {             this.threadName = threadName;             this.queueSizeLimit = queueSizeLimit;             this.period = period;             this.lastFlushTime = System.currentTimeMillis();             this.processor = processor;             this.queue = new ArrayBlockingQueue(capacity);         }         /**          * 往阻塞队列中添加元素          * @param item 添加的对象          * @return true:添加成功 false:添加失败          */         public boolean add(T item) {         // log.info("add result:"+item);             boolean result = this.queue.offer(item);           // log.info("resultP{}",result);             this.checkQueueSize();             return result;         }         /**          * 当前时间与上次任务处理时间差是否超过指定阈值;如果超过触发start方法          */         public void timeout() {           // log.info("{}====check timeout",currentThread.getName());             if (System.currentTimeMillis() - this.lastFlushTime >= (long)this.period) {                 log.info("当前时间距离上次任务处理时间周期={}超出指定阈值={}",System.currentTimeMillis() - this.lastFlushTime ,period);                 this.start();          &nb
首页 上一页 1 2 3 4 5 6 7 下一页 尾页 4/8/8
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇学习笔记——Http协议 下一篇学习笔记——ServletConfig,Servl..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目