2017-11-14 16 views
0

많은 예약 된 작업을 스케줄러와 병렬로 실행하려고 시도하지만 하나만 시작됩니다. 스프링 scheduler.xml 내 콩 구성Spring, Java - 많은 예약 된 작업을 병렬로 실행하십시오.

<?xml version="1.0" encoding="UTF-8"?> 
<beans xmlns="http://www.springframework.org/schema/beans" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:p="http://www.springframework.org/schema/p" 
    xmlns:task="http://www.springframework.org/schema/task" 
    xsi:schemaLocation="http://www.springframework.org/schema/beans 
      http://www.springframework.org/schema/beans/spring-beans-3.2.xsd 
      http://www.springframework.org/schema/task 
      http://www.springframework.org/schema/task/spring-task-3.2.xsd"> 

    <task:executor id="executor" pool-size="5"/> 
    <task:scheduler id="scheduler" pool-size="10"/> 

    <bean id="UpdateScheduler" class="org.ws.scheduled.UpdateScheduler" /> 
    <bean id="PatchData" class="org.ws.scheduled.PatchData" /> 

    <task:scheduled-tasks> 
     <task:scheduled ref="UpdateScheduler" method="start" fixed-delay="1000" /> 
     <task:scheduled ref="PatchData" method="start" fixed-delay="5000" /> 
    </task:scheduled-tasks> 

    <task:annotation-driven scheduler="scheduler" executor="executor" /> 

</beans> 
+0

여기에서 잘 일하고있어 스케줄러 및 실행 프로그램. –

+0

예제를 작성할 수 있습니까? – prilia

+0

스케줄러와 실행 프로그램을''에 연결해야합니다. 현재 실행할 다른 스케줄러/실행 프로그램이 생성됩니다. –

답변

0

여러분 모두 감사합니다! 나는이 설정과 함께 사용하기 시작하고 그것은 당신이 구성 당신에 대해 아무것도 모르는, 당신이 혼합되어 주석과 XML 후자를 사용하는 https://docs.spring.io/spring/docs/current/spring-framework-reference/integration.html#scheduling-task-namespace-scheduled-tasks

<task:scheduled-tasks scheduler="myScheduler"> 
    <task:scheduled ref="beanA" method="methodA" fixed-delay="5000" initial-delay="1000"/> 
    <task:scheduled ref="beanB" method="methodB" fixed-rate="5000"/> 
    <task:scheduled ref="beanC" method="methodC" cron="*/5 * * * * MON-FRI"/>