Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
什么是默认执行策略Executors.newSingleThreadExecutor()? 这有记录吗?
Executors.newSingleThreadExecutor()
我需要保证先进先出。
JavaDocExecutors.newSingleThreadExecutor()说:
任务保证按顺序执行
如果这对您来说还不够,请查看源代码,它LinkedBlockingQueue在幕后使用:
LinkedBlockingQueue
此队列对元素进行 FIFO(先进先出)排序。