2020java面试题,找不到工作来找我(二)_public class number implements runnable { final in-CSDN博客

网站介绍:文章浏览阅读1.2k次。阻塞线程。put 操作-生产者与带超时时间的 poll 类似不同在于 put 时候如果当前队列满了它会一直等待其他线程调用 notFull.signal 才会被唤醒。take 操作-消费者与带超时时间的 poll 类似不同在于 take 时候如果当前队列空了它会一直等待其他线程调用 notEmpty.signal()才会被唤醒。size 操作-消费者当前队列元素个数,如代码直接使用原子变量 count 获取。public int size() { return count.get();_public class number implements runnable { final int smaller=-1,larger=1,succ