程序包 gu.sql2java
类 QueueBufferProducerAction<B extends gu.sql2java.BaseBean,T>
java.lang.Object
gu.sql2java.QueueBufferProducerAction<B,T>
- 类型参数:
B- 从数据库读取的原始记录对象类型T- 队列中保存的基于B转换的数据库对象类型
- 所有已实现的接口:
gu.sql2java.TableManager.Action<B>
public class QueueBufferProducerAction<B extends gu.sql2java.BaseBean,T>
extends Object
implements gu.sql2java.TableManager.Action<B>
实现向阻塞队列输出数据库记录的
为异步输出数据库查询记录提供技术基础, 作为数据库记录的生产者向将从数据库中读取的数据库记录转换为指定的类型添加到阻塞队列,供另一端的消费者使用, 当消费端停止消费时,即停止工作。
TableManager.Action接口为异步输出数据库查询记录提供技术基础, 作为数据库记录的生产者向将从数据库中读取的数据库记录转换为指定的类型添加到阻塞队列,供另一端的消费者使用, 当消费端停止消费时,即停止工作。
- 从以下版本开始:
- 3.15.4
- 作者:
- guyadong
-
嵌套类概要
嵌套类修饰符和类型类说明static classQueueBufferProducerAction.SimpleQueueProducerAction<B extends gu.sql2java.BaseBean>QueueBufferProducerAction的简化版本,队列类型为数据库原始记录类型 -
构造器概要
构造器构造器说明QueueBufferProducerAction(int queueCapaticy, int bufferCapacity, int queueTimeout, AtomicBoolean stopped, com.google.common.base.Function<B, T> transformer, boolean outputProgress, long rowCount) 构造方法QueueBufferProducerAction(QueueBufferProducerAction<B, T> action, long rowCount) 构造方法
从原对象复制构造新对象,除了rowCount字段都从原对象复制,用于多线程异步查询所需要的action对象构建QueueBufferProducerAction(AtomicBoolean stopped, com.google.common.base.Function<B, T> transformer, long rowCount) 简化版本构造方法
队列容量和插入队列超时时间使用默认值QueueBufferProducerAction(BlockingQueue<List<T>> queue, int bufferCapacity, int queueTimeout, AtomicBoolean stopped, com.google.common.base.Function<B, T> transformer, boolean outputProgress, long rowCount) 构造方法 -
方法概要
-
构造器详细资料
-
QueueBufferProducerAction
public QueueBufferProducerAction(BlockingQueue<List<T>> queue, int bufferCapacity, int queueTimeout, AtomicBoolean stopped, com.google.common.base.Function<B, T> transformer, boolean outputProgress, long rowCount) 构造方法- 参数:
queue- 阻塞队列bufferCapacity- 缓冲区容量queueTimeout- 插入队列超时时间(秒), 队列满后超过这个时间不能插入新记录即视消费端中止,并中止插入 小于等于0使用默认值DEFAULT_QUEUE_TIMEOUTstopped- 停止标志,为null忽略,为true时不再向队列添加数据,抛出QueueTimeoutException,结束循环transformer- B到T的数据类型转换器outputProgress- 是否输出进度rowCount- 当前查询的记录总数
-
QueueBufferProducerAction
public QueueBufferProducerAction(int queueCapaticy, int bufferCapacity, int queueTimeout, AtomicBoolean stopped, com.google.common.base.Function<B, T> transformer, boolean outputProgress, long rowCount) 构造方法- 参数:
queueCapaticy- 队列容量,小于等于0使用默认值DEFAULT_QUEUE_CAPACITYbufferCapacity- 缓冲区容量queueTimeout- 插入队列超时时间(秒), 队列满后超过这个时间不能插入新记录即视消费端中止,并中止插入 小于等于0使用默认值DEFAULT_QUEUE_TIMEOUTstopped- 停止标志,为null忽略,为true时不再向队列添加数据,抛出QueueTimeoutException,结束循环transformer- B到T的数据类型转换器outputProgress- 是否输出进度rowCount- 当前查询的记录总数
-
QueueBufferProducerAction
构造方法
从原对象复制构造新对象,除了rowCount字段都从原对象复制,用于多线程异步查询所需要的action对象构建- 参数:
action-rowCount- 当前查询的记录总数
-
QueueBufferProducerAction
public QueueBufferProducerAction(AtomicBoolean stopped, com.google.common.base.Function<B, T> transformer, long rowCount) 简化版本构造方法
队列容量和插入队列超时时间使用默认值- 参数:
stopped- 停止标志,为null忽略,为true时不再向队列添加数据,抛出QueueTimeoutException,结束循环transformer- B到T的数据类型转换器rowCount- 当前查询的记录总数
-
-
方法详细资料
-
getQueue
-
getRowCount
public long getRowCount()- 返回:
- rowCount
-
getBufferCapacity
public int getBufferCapacity() -
call
将数据库中获取的原始数据库对象通过转换器(transformer)转换为指定类型插入到阻塞队列中。 当阻塞队列满添加元素超时即视为消费端停止,即停止工作,抛出QueueTimeoutException异常, 以中止从数据库中读取记录的过程- 指定者:
call在接口中gu.sql2java.TableManager.Action<B extends gu.sql2java.BaseBean>
-