Skip to content

Instantly share code, notes, and snippets.

View shuzheng's full-sized avatar
👉
公众号: zhangshuzheng_cn

张恕征 shuzheng

👉
公众号: zhangshuzheng_cn
View GitHub Profile
@shuzheng
shuzheng / BufferQueue.java
Created August 9, 2022 03:26
缓冲队列: 一个线程安全的Queue,可实现缓冲功能,当满足指定缓冲数量或缓冲时间两个条件任意一个时,执行回调方法返回缓冲数据
import java.util.ArrayList;
import java.util.List;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedDeque;
/**
* 缓冲队列
* 一个线程安全的Queue,可实现缓冲功能,当满足指定缓冲数量或缓冲时间两个条件任意一个时,执行回调方法返回缓冲数据
* @author shuzheng
* @date 2022/8/9