Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
Y
yzg-util
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
YZG
yzg-util
Commits
083f61f3
Commit
083f61f3
authored
Sep 18, 2020
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改MQ请求尸体,防止出错
parent
0bc82ab4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
47 deletions
+31
-47
BeanDao.java
...util-mq/src/main/java/com/yanzuoguang/mq/dao/BeanDao.java
+30
-46
QueueServiceImpl.java
...ava/com/yanzuoguang/mq/service/impl/QueueServiceImpl.java
+1
-1
No files found.
yzg-util-mq/src/main/java/com/yanzuoguang/mq/dao/BeanDao.java
View file @
083f61f3
...
@@ -16,6 +16,7 @@ import java.util.Map;
...
@@ -16,6 +16,7 @@ import java.util.Map;
/**
/**
* 基本队列处理类
* 基本队列处理类
*
* @author 颜佐光
* @author 颜佐光
*/
*/
@Component
@Component
...
@@ -76,14 +77,6 @@ public class BeanDao {
...
@@ -76,14 +77,6 @@ public class BeanDao {
return
bean
;
return
bean
;
}
}
// 开启锁
synchronized
(
this
)
{
// 判断队列是否存在
bean
=
getBean
(
Queue
.
class
,
key
);
if
(
bean
!=
null
)
{
return
bean
;
}
// 创建队列实体
// 创建队列实体
if
(
StringHelper
.
isEmpty
(
deadExchange
,
deadRouteKey
))
{
if
(
StringHelper
.
isEmpty
(
deadExchange
,
deadRouteKey
))
{
// 创建实体
// 创建实体
...
@@ -106,7 +99,6 @@ public class BeanDao {
...
@@ -106,7 +99,6 @@ public class BeanDao {
// 将实体注册到上下文中
// 将实体注册到上下文中
register
(
key
,
bean
);
register
(
key
,
bean
);
}
// 重新获取实体
// 重新获取实体
return
getBean
(
Queue
.
class
,
key
);
return
getBean
(
Queue
.
class
,
key
);
...
@@ -172,13 +164,6 @@ public class BeanDao {
...
@@ -172,13 +164,6 @@ public class BeanDao {
if
(
bean
!=
null
)
{
if
(
bean
!=
null
)
{
return
bean
;
return
bean
;
}
}
// 开启锁
synchronized
(
this
)
{
// 判断队列是否存在
bean
=
getBean
(
TopicExchange
.
class
,
key
);
if
(
bean
!=
null
)
{
return
bean
;
}
// 创建实体
// 创建实体
bean
=
new
TopicExchange
(
exchangeName
,
true
,
false
);
bean
=
new
TopicExchange
(
exchangeName
,
true
,
false
);
...
@@ -187,7 +172,6 @@ public class BeanDao {
...
@@ -187,7 +172,6 @@ public class BeanDao {
// 将实体注册到上下文中
// 将实体注册到上下文中
register
(
key
,
bean
);
register
(
key
,
bean
);
}
// 重新获取实体
// 重新获取实体
return
getBean
(
TopicExchange
.
class
,
key
);
return
getBean
(
TopicExchange
.
class
,
key
);
...
...
yzg-util-mq/src/main/java/com/yanzuoguang/mq/service/impl/QueueServiceImpl.java
View file @
083f61f3
...
@@ -4,7 +4,6 @@ import com.yanzuoguang.mq.dao.BeanDao;
...
@@ -4,7 +4,6 @@ import com.yanzuoguang.mq.dao.BeanDao;
import
com.yanzuoguang.mq.service.QueueService
;
import
com.yanzuoguang.mq.service.QueueService
;
import
com.yanzuoguang.mq.vo.QueueVo
;
import
com.yanzuoguang.mq.vo.QueueVo
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
com.yanzuoguang.util.thread.ThreadHelper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
...
@@ -37,6 +36,7 @@ public class QueueServiceImpl implements QueueService {
...
@@ -37,6 +36,7 @@ public class QueueServiceImpl implements QueueService {
*/
*/
private
void
initBean
(
QueueVo
vo
)
{
private
void
initBean
(
QueueVo
vo
)
{
vo
.
check
();
vo
.
check
();
// 创建死信队列
// 创建死信队列
if
(!
StringHelper
.
isEmpty
(
vo
.
getDedQueueName
()))
{
if
(!
StringHelper
.
isEmpty
(
vo
.
getDedQueueName
()))
{
beanDao
.
createQueue
(
vo
.
getDedQueueName
());
beanDao
.
createQueue
(
vo
.
getDedQueueName
());
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment