|
|
|
|
@ -176,11 +176,15 @@ class MessageBrokerBeanDefinitionParser implements BeanDefinitionParser {
@@ -176,11 +176,15 @@ class MessageBrokerBeanDefinitionParser implements BeanDefinitionParser {
|
|
|
|
|
ParserContext parserCxt, Object source) { |
|
|
|
|
|
|
|
|
|
RootBeanDefinition executorDef = null; |
|
|
|
|
Element executor = null; |
|
|
|
|
|
|
|
|
|
if (channelElement != null) { |
|
|
|
|
executor = DomUtils.getChildElementByTagName(channelElement, "executor"); |
|
|
|
|
if (executor != null) { |
|
|
|
|
if (channelElement == null) { |
|
|
|
|
executorDef = getDefaultExecutorBeanDefinition(channelName); |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
Element executor = DomUtils.getChildElementByTagName(channelElement, "executor"); |
|
|
|
|
if (executor == null) { |
|
|
|
|
executorDef = getDefaultExecutorBeanDefinition(channelName); |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
executorDef = new RootBeanDefinition(ThreadPoolTaskExecutor.class); |
|
|
|
|
String attrValue = executor.getAttribute("core-pool-size"); |
|
|
|
|
if (!StringUtils.isEmpty(attrValue)) { |
|
|
|
|
@ -200,22 +204,16 @@ class MessageBrokerBeanDefinitionParser implements BeanDefinitionParser {
@@ -200,22 +204,16 @@ class MessageBrokerBeanDefinitionParser implements BeanDefinitionParser {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if ((channelElement == null && !channelName.equals("brokerChannel")) || (channelElement != null && executor == null)) { |
|
|
|
|
executorDef = new RootBeanDefinition(ThreadPoolTaskExecutor.class); |
|
|
|
|
executorDef.getPropertyValues().add("corePoolSize", Runtime.getRuntime().availableProcessors() * 2); |
|
|
|
|
executorDef.getPropertyValues().add("maxPoolSize", Integer.MAX_VALUE); |
|
|
|
|
executorDef.getPropertyValues().add("queueCapacity", Integer.MAX_VALUE); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ConstructorArgumentValues values = new ConstructorArgumentValues(); |
|
|
|
|
ConstructorArgumentValues argValues = new ConstructorArgumentValues(); |
|
|
|
|
if (executorDef != null) { |
|
|
|
|
executorDef.getPropertyValues().add("threadNamePrefix", channelName + "-"); |
|
|
|
|
String executorName = channelName + "Executor"; |
|
|
|
|
registerBeanDefByName(executorName, executorDef, parserCxt, source); |
|
|
|
|
values.addIndexedArgumentValue(0, new RuntimeBeanReference(executorName)); |
|
|
|
|
argValues.addIndexedArgumentValue(0, new RuntimeBeanReference(executorName)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
RootBeanDefinition channelDef = new RootBeanDefinition(ExecutorSubscribableChannel.class, values, null); |
|
|
|
|
RootBeanDefinition channelDef = new RootBeanDefinition(ExecutorSubscribableChannel.class, argValues, null); |
|
|
|
|
|
|
|
|
|
if (channelElement != null) { |
|
|
|
|
Element interceptorsElement = DomUtils.getChildElementByTagName(channelElement, "interceptors"); |
|
|
|
|
@ -227,6 +225,17 @@ class MessageBrokerBeanDefinitionParser implements BeanDefinitionParser {
@@ -227,6 +225,17 @@ class MessageBrokerBeanDefinitionParser implements BeanDefinitionParser {
|
|
|
|
|
return new RuntimeBeanReference(channelName); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private RootBeanDefinition getDefaultExecutorBeanDefinition(String channelName) { |
|
|
|
|
if (channelName.equals("brokerChannel")) { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
RootBeanDefinition executorDef = new RootBeanDefinition(ThreadPoolTaskExecutor.class); |
|
|
|
|
executorDef.getPropertyValues().add("corePoolSize", Runtime.getRuntime().availableProcessors() * 2); |
|
|
|
|
executorDef.getPropertyValues().add("maxPoolSize", Integer.MAX_VALUE); |
|
|
|
|
executorDef.getPropertyValues().add("queueCapacity", Integer.MAX_VALUE); |
|
|
|
|
return executorDef; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private RuntimeBeanReference registerSubProtocolWebSocketHandler(Element element, |
|
|
|
|
RuntimeBeanReference clientInChannel, RuntimeBeanReference clientOutChannel, |
|
|
|
|
RuntimeBeanReference userSessionRegistry, ParserContext parserCxt, Object source) { |
|
|
|
|
|