考虑applicationContext.xml的以下片段:
<task:scheduler id="xfsXmlProducer" pool-size="1" />
<task:scheduler id="xfsXmlConsumer" pool-size="${transactionqueue.consumerThreadsCount}" />
<task:scheduled-tasks scheduler="xfsXmlProducer">
<task:scheduled ref="xmlFileProducerJob" method="run" fixed-delay="3000"/>
</task:scheduled-tasks>
<task:scheduled-tasks scheduler="xfsXmlConsumer">
<task:scheduled ref="xmlFileConsumerJob" method="run" fixed-delay="10"/>
<task:scheduled ref="xmlFileConsumerJob" method="run" fixed-delay="10"/>
<task:scheduled ref="xmlFileConsumerJob" method="run" fixed-delay="10"/>
<task:scheduled ref="xmlFileConsumerJob" method="run" fixed-delay="10"/>
<task:scheduled ref="xmlFileConsumerJob" method="run" fixed-delay="10"/>
</task:scheduled-tasks>
<bean id="xmlFileConsumerJob"
class="xxxx.parser.job.XmlFileConsumerJob"
lazy-init="true"
scope="prototype"/>
<bean id="xmlFileProducerJob"
class="xxxx.parser.job.XmlFileProducerJob" lazy-init="true">
<property name="transactionBulkSize" value="${transactionqueue.bulkSize}" />
</bean>
有没有办法避免重复
<task:scheduled ref="xmlFileConsumerJob" method="run" fixed-delay="10"/>
我想指定一些工人。