Commit 9237735b authored by yanzg's avatar yanzg

身份证识别

parent 618c2aaa
......@@ -16,10 +16,11 @@ import java.util.concurrent.ConcurrentLinkedQueue;
* @author 颜佐光
*/
@Component
public class QueueServiceImpl implements QueueService, Runnable {
public class QueueServiceImpl implements QueueService {
private final BeanDao beanDao;
private final Queue<QueueVo> queue = new ConcurrentLinkedQueue<>();
private boolean isAsyncRun = false;
public static boolean DEFAULT_IS_ASYNC = false;
public QueueServiceImpl(BeanDao beanDao) {
this.beanDao = beanDao;
......@@ -33,7 +34,7 @@ public class QueueServiceImpl implements QueueService, Runnable {
*/
@Override
public void create(QueueVo req) {
initBean(req, true);
initBean(req, DEFAULT_IS_ASYNC);
}
@Override
......@@ -57,7 +58,9 @@ public class QueueServiceImpl implements QueueService, Runnable {
}
synchronized (this) {
isAsyncRun = true;
new Thread(this).start();
Thread thread = new Thread(this::handleQueue);
thread.setDaemon(true);
thread.start();
}
}
}
......@@ -85,8 +88,7 @@ public class QueueServiceImpl implements QueueService, Runnable {
beanDao.createBinding(vo.getExchangeName(), vo.getQueueName(), vo.getRouteKey());
}
@Override
public void run() {
private void handleQueue() {
while (!this.queue.isEmpty()) {
QueueVo vo = this.queue.poll();
try {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment