Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
.-Smile-.
spring-framework
提交
1bc41bdf
S
spring-framework
项目概览
.-Smile-.
/
spring-framework
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
spring-framework
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1bc41bdf
编写于
11月 02, 2015
作者:
S
Stephane Nicoll
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Expose JMS message listener container ids
Issue: SPR-13633
上级
cca037a7
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
15 addition
and
1 deletion
+15
-1
spring-jms/src/main/java/org/springframework/jms/config/JmsListenerEndpointRegistry.java
...ringframework/jms/config/JmsListenerEndpointRegistry.java
+10
-0
spring-jms/src/test/java/org/springframework/jms/annotation/AbstractJmsAnnotationDrivenTests.java
...work/jms/annotation/AbstractJmsAnnotationDrivenTests.java
+2
-0
spring-jms/src/test/java/org/springframework/jms/config/JmsListenerEndpointRegistrarTests.java
...amework/jms/config/JmsListenerEndpointRegistrarTests.java
+3
-1
未找到文件。
spring-jms/src/main/java/org/springframework/jms/config/JmsListenerEndpointRegistry.java
浏览文件 @
1bc41bdf
...
@@ -19,6 +19,7 @@ package org.springframework.jms.config;
...
@@ -19,6 +19,7 @@ package org.springframework.jms.config;
import
java.util.Collection
;
import
java.util.Collection
;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.atomic.AtomicInteger
;
import
java.util.concurrent.atomic.AtomicInteger
;
...
@@ -68,12 +69,21 @@ public class JmsListenerEndpointRegistry implements DisposableBean, SmartLifecyc
...
@@ -68,12 +69,21 @@ public class JmsListenerEndpointRegistry implements DisposableBean, SmartLifecyc
* @param id the id of the container
* @param id the id of the container
* @return the container or {@code null} if no container with that id exists
* @return the container or {@code null} if no container with that id exists
* @see JmsListenerEndpoint#getId()
* @see JmsListenerEndpoint#getId()
* @see #getListenerContainerIds()
*/
*/
public
MessageListenerContainer
getListenerContainer
(
String
id
)
{
public
MessageListenerContainer
getListenerContainer
(
String
id
)
{
Assert
.
notNull
(
id
,
"Container identifier must not be null"
);
Assert
.
notNull
(
id
,
"Container identifier must not be null"
);
return
this
.
listenerContainers
.
get
(
id
);
return
this
.
listenerContainers
.
get
(
id
);
}
}
/**
* Return the ids of the managed {@link MessageListenerContainer} instance(s).
* @see #getListenerContainer(String)
*/
public
Set
<
String
>
getListenerContainerIds
()
{
return
Collections
.
unmodifiableSet
(
this
.
listenerContainers
.
keySet
());
}
/**
/**
* Return the managed {@link MessageListenerContainer} instance(s).
* Return the managed {@link MessageListenerContainer} instance(s).
*/
*/
...
...
spring-jms/src/test/java/org/springframework/jms/annotation/AbstractJmsAnnotationDrivenTests.java
浏览文件 @
1bc41bdf
...
@@ -169,6 +169,8 @@ public abstract class AbstractJmsAnnotationDrivenTests {
...
@@ -169,6 +169,8 @@ public abstract class AbstractJmsAnnotationDrivenTests {
JmsListenerEndpointRegistry
customRegistry
=
JmsListenerEndpointRegistry
customRegistry
=
context
.
getBean
(
"customRegistry"
,
JmsListenerEndpointRegistry
.
class
);
context
.
getBean
(
"customRegistry"
,
JmsListenerEndpointRegistry
.
class
);
assertEquals
(
"Wrong number of containers in the registry"
,
2
,
customRegistry
.
getListenerContainerIds
().
size
());
assertEquals
(
"Wrong number of containers in the registry"
,
2
,
assertEquals
(
"Wrong number of containers in the registry"
,
2
,
customRegistry
.
getListenerContainers
().
size
());
customRegistry
.
getListenerContainers
().
size
());
assertNotNull
(
"Container with custom id on the annotation should be found"
,
assertNotNull
(
"Container with custom id on the annotation should be found"
,
...
...
spring-jms/src/test/java/org/springframework/jms/config/JmsListenerEndpointRegistrarTests.java
浏览文件 @
1bc41bdf
/*
/*
* Copyright 2002-201
4
the original author or authors.
* Copyright 2002-201
5
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -76,6 +76,7 @@ public class JmsListenerEndpointRegistrarTests {
...
@@ -76,6 +76,7 @@ public class JmsListenerEndpointRegistrarTests {
registrar
.
afterPropertiesSet
();
registrar
.
afterPropertiesSet
();
assertNotNull
(
"Container not created"
,
registry
.
getListenerContainer
(
"some id"
));
assertNotNull
(
"Container not created"
,
registry
.
getListenerContainer
(
"some id"
));
assertEquals
(
1
,
registry
.
getListenerContainers
().
size
());
assertEquals
(
1
,
registry
.
getListenerContainers
().
size
());
assertEquals
(
"some id"
,
registry
.
getListenerContainerIds
().
iterator
().
next
());
}
}
@Test
@Test
...
@@ -98,6 +99,7 @@ public class JmsListenerEndpointRegistrarTests {
...
@@ -98,6 +99,7 @@ public class JmsListenerEndpointRegistrarTests {
registrar
.
afterPropertiesSet
();
registrar
.
afterPropertiesSet
();
assertNotNull
(
"Container not created"
,
registry
.
getListenerContainer
(
"myEndpoint"
));
assertNotNull
(
"Container not created"
,
registry
.
getListenerContainer
(
"myEndpoint"
));
assertEquals
(
1
,
registry
.
getListenerContainers
().
size
());
assertEquals
(
1
,
registry
.
getListenerContainers
().
size
());
assertEquals
(
"myEndpoint"
,
registry
.
getListenerContainerIds
().
iterator
().
next
());
}
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录