Springトランザクション内のマルチスレッド処理-ソリューション

49412 ワード

まず、Spring Ioc依存注入は単一のオブジェクトであり、同じ処理が複数あり、あまり時間がかからない場合はforループを用いて直接実行するのが一般的であり、トランザクション管理があってもビジネスの実行に影響を与えない.しかし、多くのアプリケーション、例えば、システムとシステムの間のインタラクションは時間がかかり、forループを使用してビジネスを実行することは望ましくないので、スレッドでこの問題を解決したいと思っています.この中で踏んだ穴は自分で這い出してこそ中の理由がわかる.
================================================
また、Springで提供されている@Testでテストした場合、マルチスレッド処理がある場合はThread.sleep(3000)を呼び出す必要があります.スレッド待ちを実現することは、マルチスレッドモードをテストするためにも必要です.スレッドを付けないとスリープし,マルチスレッドの実行が完了するのを待たずに,マルチスレッド呼び出しの処理が測定できない可能性が高い.
前提:ビジネス・メソッドを呼び出すと、マルチスレッドが複数の同じ操作を実行できます.
質問:Springトランザクション管理の下でのメソッド内でマルチスレッドプロセッシングタスクを使用している場合は可能ですか?
一般的には、呼び出し時に@autowireが必要なサービスクラスだけでいいです.理想的には、次のコードが最も一般的な実装です.
1.ビジネス・スレッド・クラスの作成
package com.wlyd.fmcgwms.util.thread;

import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import com.wlyd.fmcgwms.persistence.beans.platform.Corporation;
import com.wlyd.fmcgwms.service.basic.WmStockService;

public class UpdateProductThead extends Thread {
    
     private ThreadPoolTaskExecutor taskExecutor;
     
     public ThreadPoolTaskExecutor getTaskExecutor() {
         return taskExecutor;
     }
     
     public void setTaskExecutor(ThreadPoolTaskExecutor taskExecutor) {
         this.taskExecutor = taskExecutor;
     }
    
    ExecutorService executorService; 
    
    private WmStockService wmStockService;
    
    private List corporations;
    
    public UpdateProductThead( WmStockService wmStockService,List corporations) {
        this.wmStockService = wmStockService;
        this.corporations = corporations;
        executorService = Executors.newFixedThreadPool(corporations==null?0:corporations.size()); 
    }

    /*@Override
    public void run() {
        for (int i = 0; i < corporations.size(); i++) {
            new Thread(new DoBusinessThread(i));
        }
    }*/
    
    @Override
    public void run() {
        taskExecutor=new ThreadPoolTaskExecutor();
        for (int i = 0; i < corporations.size(); i++) {
            taskExecutor.execute(new DoBusinessThread(i));
        }
    }
    
    /*@Override
    public void run() {
        for (int i = 0; i < corporations.size(); i++) {
            executorService.execute(new DoBusinessThread(i));
            System.out.println();
        }
    }*/

    class DoBusinessThread extends Thread{
        
        private int index=0;
        
        public DoBusinessThread(int index){
            this.index=index;
        }

        @Override
        public void run() {
            wmStockService.updateProductStockProcess(corporations.get(index)); 
        }
        
    }

}


以上の3つの方式のスレッドrun実行効果はいずれも同じである.
2.業務スレッド類の実行状況をテストする
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "classpath:applicationContext.xml")
public class APIServiceTest {

       @Autowired
    WmStockService wmStockService;
    
    @Autowired
    CorporationMapper corporationMapper;
        
	@Test
	public void testUpdateProductWithThread(){
		List corporations=corporationMapper.findAll();
		
		new UpdateProductThead(wmStockService, corporations);
	}
}

私たちが最も見たいのは、プログラムが実行されて成功したことだが、これは望みに反している.上記のようにビジネススレッドが実行されるものは1つもありません.
スレッド内のrunメソッドが次の方法のみを実行する場合:
wmStockService.updateProductStockProcess(corporation);

成功したスレッドが1つだけ成功し、データ・ソースが閉じられます.
package com.wlyd.fmcgwms.util.thread;

import com.wlyd.fmcgwms.persistence.beans.platform.Corporation;
import com.wlyd.fmcgwms.service.basic.WmStockService;

public class UpdateProductThead extends Thread {
	
	private WmStockService wmStockService;
	
	private Corporation corporations;
	
	public UpdateProductThead( WmStockService wmStockService,Corporation corporation) {
		this.wmStockService = wmStockService;
		this.corporation = corporation; 
	}

	@Override
	public void run() {
           wmStockService.updateProductStockProcess(corporation);
       }
}

3.最も原始的なForサイクル
外部ビジネスコール:
public void updateProductStock() {
		try {
			List corps = corporationMapper.findAll();
			if (corps == null || corps.size() == 0) {
				return ;
			}
			for (Corporation corporation : corps) {
				//         
				if (corporation.getEsCorAlias() == null
						|| corporation.getEsCorAlias().equals("")
						|| corporation.getEsCorAlias().equals("10000")
						|| corporation.getEsCorAlias().equals("10002")) {
					continue;
				}
				wmStockService.updateProductStockProcess(corporation);
				//             ---Spring            ,  for           
				//new UpdateProductThead(wmStockService, corporation).start();
			}
		} catch (Exception e) {
			Log.getLogger(getClass()).error(">>>>      OMS          :"+e.getMessage());
		}

}

業務の処理方法(詳しい過程は貼らない):
public void updateProductStockProcess(Corporation corporation) {

      //       

      //           
}

テスト:
@Test
public void testUpdateProduct(){
	quartzJobService.updateProductStock();
}

今回は正常に動作します.
2016-07-29 16:53:46,553 [main] DEBUG [java.sql.Connection] - ooo Using Connection [com.mysql.jdbc.JDBC4Connection@2e8ab815]
2016-07-29 16:53:46,553 [main] DEBUG [java.sql.Connection] - ==>  Preparing: SELECT cd.CDSK_ITEM_CODE ProductCode,st.WMST_NOW_NUMBER ProductNum,st.WMST_ENABLED_NUMBER AvailableProductNum,st.WMST_SKU_UNIT ProductUnit FROM wm_stock_10003 st LEFT JOIN cd_wh_itme_10003 cd ON cd.CD_ITEM_ID=st.WMST_SKU_ID GROUP BY st.WMST_SKU_NAME,st.WMST_SKU_UNIT 
2016-07-29 16:53:46,553 [main] DEBUG [java.sql.PreparedStatement] - ==> Parameters: 
2016-07-29 16:53:46,617 [main] INFO  [com.wlyd.fmcgwms.service.platform.impl.JZTDAPIServiceImpl] -       OMS  .........../updateproductstock REQUEST:{"Products":[{"AvailableProductNum":20,"ProductCode":"10003160503009","ProductNum":40,"ProductUnit":" "},{"AvailableProductNum":100,"ProductCode":"10003160503009","ProductNum":100,"ProductUnit":" "},{"AvailableProductNum":13,"ProductCode":"10003160503001","ProductNum":14,"ProductUnit":" "},{"AvailableProductNum":7,"ProductCode":"10003160503002","ProductNum":10,"ProductUnit":" "},{"AvailableProductNum":50,"ProductCode":"10003160503002","ProductNum":100,"ProductUnit":" "},{"AvailableProductNum":40,"ProductCode":"10003160503005","ProductNum":100,"ProductUnit":" "},{"AvailableProductNum":0,"ProductCode":"10003160503005","ProductNum":5,"ProductUnit":" "},{"AvailableProductNum":0,"ProductCode":"10003160503007","ProductNum":30,"ProductUnit":" "},{"AvailableProductNum":20,"ProductCode":"10003160503007","ProductNum":25,"ProductUnit":" "},{"AvailableProductNum":5,"ProductCode":"10003160503004","ProductNum":55,"ProductUnit":" "},{"AvailableProductNum":50,"ProductCode":"10003160503006","ProductNum":149,"ProductUnit":" "},{"AvailableProductNum":0,"ProductCode":"10003160503006","ProductNum":6,"ProductUnit":" "},{"AvailableProductNum":0,"ProductCode":"10003160503003","ProductNum":100,"ProductUnit":" "},{"AvailableProductNum":7,"ProductCode":"10003160503008","ProductNum":7,"ProductUnit":" "},{"AvailableProductNum":9,"ProductCode":"10003160503008","ProductNum":9,"ProductUnit":" "}]}
2016-07-29 16:53:46,618 [main] INFO  [com.wlyd.fmcgwms.service.platform.impl.JZTDAPIServiceImpl] -       OMS  .........../updateproductstock NO RESPONSE:Illegal character(s) in message header value: *
2016-07-29 16:53:46,622 [main] ERROR [com.wlyd.fmcgwms.service.basic.impl.WmStockServiceImpl] - >>>>      OMS          :true
2016-07-29 16:53:46,624 [main] DEBUG [java.sql.Connection] - ooo Using Connection [com.mysql.jdbc.JDBC4Connection@2e8ab815]
2016-07-29 16:53:46,624 [main] DEBUG [java.sql.Connection] - ==>  Preparing: SELECT cd.CDSK_ITEM_CODE ProductCode,st.WMST_NOW_NUMBER ProductNum,st.WMST_ENABLED_NUMBER AvailableProductNum,st.WMST_SKU_UNIT ProductUnit FROM wm_stock_10004 st LEFT JOIN cd_wh_itme_10004 cd ON cd.CD_ITEM_ID=st.WMST_SKU_ID GROUP BY st.WMST_SKU_NAME,st.WMST_SKU_UNIT 
2016-07-29 16:53:46,624 [main] DEBUG [java.sql.PreparedStatement] - ==> Parameters: 
2016-07-29 16:53:46,629 [main] INFO  [com.wlyd.fmcgwms.service.basic.impl.WmStockServiceImpl] - >>>>  (10004)            !!!
2016-07-29 16:53:46,630 [main] DEBUG [java.sql.Connection] - ooo Using Connection [com.mysql.jdbc.JDBC4Connection@2e8ab815]
2016-07-29 16:53:46,630 [main] DEBUG [java.sql.Connection] - ==>  Preparing: SELECT cd.CDSK_ITEM_CODE ProductCode,st.WMST_NOW_NUMBER ProductNum,st.WMST_ENABLED_NUMBER AvailableProductNum,st.WMST_SKU_UNIT ProductUnit FROM wm_stock_10005 st LEFT JOIN cd_wh_itme_10005 cd ON cd.CD_ITEM_ID=st.WMST_SKU_ID GROUP BY st.WMST_SKU_NAME,st.WMST_SKU_UNIT 
2016-07-29 16:53:46,630 [main] DEBUG [java.sql.PreparedStatement] - ==> Parameters: 
2016-07-29 16:53:46,633 [main] INFO  [com.wlyd.fmcgwms.service.basic.impl.WmStockServiceImpl] - >>>>  (10005)                  !!!
2016-07-29 16:53:46,633 [main] DEBUG [java.sql.Connection] - ooo Using Connection [com.mysql.jdbc.JDBC4Connection@2e8ab815]
2016-07-29 16:53:46,633 [main] DEBUG [java.sql.Connection] - ==>  Preparing: SELECT cd.CDSK_ITEM_CODE ProductCode,st.WMST_NOW_NUMBER ProductNum,st.WMST_ENABLED_NUMBER AvailableProductNum,st.WMST_SKU_UNIT ProductUnit FROM wm_stock_10006 st LEFT JOIN cd_wh_itme_10006 cd ON cd.CD_ITEM_ID=st.WMST_SKU_ID GROUP BY st.WMST_SKU_NAME,st.WMST_SKU_UNIT 
2016-07-29 16:53:46,633 [main] DEBUG [java.sql.PreparedStatement] - ==> Parameters: 
2016-07-29 16:53:46,636 [main] INFO  [com.wlyd.fmcgwms.service.basic.impl.WmStockServiceImpl] - >>>>  (10006)test1      !!!
2016-07-29 16:53:46,637 [main] DEBUG [java.sql.Connection] - ooo Using Connection [com.mysql.jdbc.JDBC4Connection@2e8ab815]
2016-07-29 16:53:46,637 [main] DEBUG [java.sql.Connection] - ==>  Preparing: SELECT cd.CDSK_ITEM_CODE ProductCode,st.WMST_NOW_NUMBER ProductNum,st.WMST_ENABLED_NUMBER AvailableProductNum,st.WMST_SKU_UNIT ProductUnit FROM wm_stock_10007 st LEFT JOIN cd_wh_itme_10007 cd ON cd.CD_ITEM_ID=st.WMST_SKU_ID GROUP BY st.WMST_SKU_NAME,st.WMST_SKU_UNIT 
2016-07-29 16:53:46,637 [main] DEBUG [java.sql.PreparedStatement] - ==> Parameters: 
2016-07-29 16:53:46,640 [main] INFO  [com.wlyd.fmcgwms.service.basic.impl.WmStockServiceImpl] - >>>>  (10007)aaabbbbbb      !!!
2016-07-29 16:53:46,640 [main] DEBUG [java.sql.Connection] - ooo Using Connection [com.mysql.jdbc.JDBC4Connection@2e8ab815]
2016-07-29 16:53:46,640 [main] DEBUG [java.sql.Connection] - ==>  Preparing: SELECT cd.CDSK_ITEM_CODE ProductCode,st.WMST_NOW_NUMBER ProductNum,st.WMST_ENABLED_NUMBER AvailableProductNum,st.WMST_SKU_UNIT ProductUnit FROM wm_stock_10008 st LEFT JOIN cd_wh_itme_10008 cd ON cd.CD_ITEM_ID=st.WMST_SKU_ID GROUP BY st.WMST_SKU_NAME,st.WMST_SKU_UNIT 
2016-07-29 16:53:46,641 [main] DEBUG [java.sql.PreparedStatement] - ==> Parameters: 
2016-07-29 16:53:46,643 [main] INFO  [com.wlyd.fmcgwms.service.basic.impl.WmStockServiceImpl] - >>>>  (10008)              !!!

シーケンスで実行すればいいのですが、これは私たちが必要とする方法ではありません.このようなデータ量が大きく、時間がかかる操作を解決するためにスレッドが必要です.
注意:ここでは、Action/Clontrollerによって開始されたリクエストではなく、タスクをスケジュールすることによってマルチスレッド処理が開始されます.
4.Spring管理スレッドプールの構成
   
      
          
   		  
          
   		  
          
    	  
          
    	  
      

ビジネス・スレッドの変更:
package com.wlyd.fmcgwms.util.thread;

import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import com.wlyd.fmcgwms.persistence.beans.platform.Corporation;
import com.wlyd.fmcgwms.service.basic.WmStockService;
/**
 *         
 * 
 * @packge com.wlyd.fmcgwms.util.thread.UpdateProductThead
 * @date   2016 7 29     5:56:22
 * @author pengjunlin
 * @comment   
 * @update
 */
public class UpdateProductThead extends Thread {
	
	public static final int THREAD_COMMON=0;
	
	public static final int THREAD_EXCUTOR_SERVICE=1;
	
	public static final int THREAD_POOL_TASK_EXCUTOER=2;
	
	private ThreadPoolTaskExecutor taskExecutor;
	
	private ExecutorService executorService; 
	
	private WmStockService wmStockService;
	
	private List corporations;
	
	private int threadType;
	
	public UpdateProductThead(int threadType,ThreadPoolTaskExecutor taskExecutor,WmStockService wmStockService,List corporations) {
		this.wmStockService = wmStockService;
		this.corporations = corporations;
		this.executorService = Executors.newFixedThreadPool(corporations==null?0:corporations.size()); 
		this.threadType=threadType;
	}

	@Override
	public void run() {
		for (int i = 0; i < corporations.size(); i++) {
			switch (threadType) {
			case 0:
				//    
				new Thread(new DoBusinessThread(i));
				break;
			case 1:
				//    
				taskExecutor.execute(new DoBusinessThread(i));
				break;
			case 2:
				//    
				executorService.execute(new DoBusinessThread(i));
				break;
			default:
				break;
			}
			
		}
	}
	

	class DoBusinessThread extends Thread{
		
		private int index=0;
		
		public DoBusinessThread(int index){
			this.index=index;
		}

		@Override
		public void run() {
			wmStockService.updateProductStockProcess(corporations.get(index)); 
		}
		
	}

}
修正テスト:
@Test
public void testUpdateProductWithThread(){
	List corporations=corporationMapper.findAll();
		
	new UpdateProductThead(UpdateProductThead.THREAD_POOL_TASK_EXCUTOER,taskExecutor,wmStockService, corporations);
}

テストを実行するか実行しないか、spring出力ログ:
2016-08-01 09:28:07,422 [Thread-4] INFO  [org.springframework.context.support.GenericApplicationContext] - Closing org.springframework.context.support.GenericApplicationContext@7ac7a4e4: startup date [Mon Aug 01 09:28:03 CST 2016]; root of context hierarchy
2016-08-01 09:28:07,426 [Thread-4] INFO  [org.springframework.context.support.DefaultLifecycleProcessor] - Stopping beans in phase 2147483647
2016-08-01 09:28:07,427 [Thread-4] INFO  [org.quartz.core.QuartzScheduler] - Scheduler SpringJobSchedulerFactoryBean_$_NON_CLUSTERED paused.
2016-08-01 09:28:07,427 [Thread-4] INFO  [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@4e08711f: defining beans [wmStockAlertRlueServiceImpl,wmWarringInfoServiceImpl,cdWarehouseServiceImpl,cdWhCustomerServiceImpl,cdWhItmeServiceImpl,cdWhLocAreaServiceImpl,cdWhLocationServiceImpl,wmStockAdjustServiceImpl,wmStockFreezeServiceImpl,wmStockReleaseServiceImpl,wmStockServiceImpl,esMenuFunctionsServiceImpl,esMrRightsServiceImpl,esMuRightsServiceImpl,WMWareHouseStatServiceImpl,esDictionaryServiceImpl,esDictionaryTypeServiceImpl,esExceptionServiceImpl,esIconsServiceImpl,esMenuServiceImpl,esPropertiesServiceImpl,esRoleServiceImpl,esUserServiceImpl,wmIntoOrderBatchCodenoServiceImpl,wmIntoOrderinfoServiceImpl,wmIntoOrderServiceImpl,wmReceiptServiceImpl,wmReturnInfoServiceImpl,wmInventorySheetDetailServiceImpl,wmInventorySheetServiceImpl,wmWarehouseMoveServiceImpl,ebInterfaceLogServiceImpl,ebIntoStockLogServiceImpl,ebOperateLogServiceImpl,ebOutStockLogServiceImpl,ebSysLogServiceImpl,wmBatchPickingServiceImpl,wmOutOrderDetailServiceImpl,wmOutOrderServiceImpl,APIForOMSServiceImpl,APIServiceImpl,corporationServiceImpl,esSaasServiceInfoServiceImpl,JZTDAPIServiceImpl,padServiceImpl,pdaApiImpl,quartzJobServiceImpl,statisticalChartsServiceImpl,stockWarringJobServiceImpl,syncOrderStutusServiceImpl,timerTaskServiceImpl,reportServiceImpl,wmItemDailyReportServiceImpl,cdWhUnpickServiceImpl,settingsServiceImpl,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#0,dataSource,sqlSessionFactory,sqlSession,org.mybatis.spring.mapper.MapperScannerConfigurer#0,transactionManager,txAdvice,org.springframework.aop.config.internalAutoProxyCreator,pc,org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#0,InitSysProperties,DailyTaskJob,DailyTaskJobMethod,DailyTaskCronTriggerBean,DailyTaskJobMethodSaas,DailyTaskCronTriggerBeanSaas,StockWarringTaskJob,StockWarringTaskJobMethod,StockWarringTaskCronTriggerBean,CycleSendInterfaceInfoTaskJob,CycleSendInterfaceInfoTaskJobMethod,CycleSendInterfaceInfoTaskCronTriggerBean,SpringJobSchedulerFactoryBean,taskExecutor,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor,wmStockAlertRuleMapper,wmWarringInfoMapper,cdCustomerMapper,cdWarehouseMapper,cdWhItmeMapper,cdWhLocAreaMapper,cdWhLocationMapper,wmStockAdjustMapper,wmStockFreezeMapper,wmStockMapper,wmStockReleaseMapper,esMenuFunctionsMapper,esMrRightsMapper,esMuRightsMapper,esDictionaryMapper,esDictionaryTypeMapper,ebUserWarehouseMapper,esExceptionMapper,esIconsMapper,esMenuMapper,esPropertiesMapper,esRoleMapper,esUserMapper,wmIntoOrderBatchCodenoMapper,wmIntoOrderCodenoMapper,wmIntoOrderInfoMapper,wmIntoOrderMapper,wmReceiptInfoMapper,wmReturnInfoMapper,wmInventorySheetDetailMapper,wmInventorySheetMapper,wmWarehouseMoveCodenoMapper,wmWarehouseMoveMapper,ebInterfaceLogMapper,ebIntoStockLogMapper,ebOperateLogMapper,ebOutStockLogMapper,ebSysLogMapper,wmAssignedPickcarMapper,wmBatchPickingMapper,wmOutOrderCodenoMapper,wmOutOrderDetailMapper,wmOutOrderMapper,wmStockAssignedMapper,corporationMapper,esSaasServiceInfoMapper,statisticalChartsMapper,wmItemTransferMapper,reportMapper,wmDailyItemReportMapper,settingsMapper,wmUnpickMapper]; root of factory hierarchy
2016-08-01 09:28:07,451 [Thread-4] INFO  [org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor] 
            - Shutting down ExecutorService 'taskExecutor'
2016-08-01 09:28:07,452 [Thread-4] INFO  [org.springframework.scheduling.quartz.SchedulerFactoryBean] - Shutting down Quartz Scheduler
2016-08-01 09:28:07,452 [Thread-4] INFO  [org.quartz.core.QuartzScheduler] - Scheduler SpringJobSchedulerFactoryBean_$_NON_CLUSTERED shutting down.
2016-08-01 09:28:07,452 [Thread-4] INFO  [org.quartz.core.QuartzScheduler] - Scheduler SpringJobSchedulerFactoryBean_$_NON_CLUSTERED paused.
2016-08-01 09:28:07,459 [Thread-4] INFO  [org.quartz.core.QuartzScheduler] - Scheduler SpringJobSchedulerFactoryBean_$_NON_CLUSTERED shutdown complete.
2016-08-01 09:28:07,482 [Thread-4] INFO  [com.alibaba.druid.pool.DruidDataSource] - {dataSource-1} closed

ログから見るとspringはマルチスレッド処理をサポートしていないはずで、このスレッドは起動すると閉じられます.間違っています.springがマルチスレッドをサポートしていないわけではありません.それは、スレッドの呼び出しstart()を書くのを忘れたので、次の5点目を書きました.
new UpdateProductThead(UpdateProductThead.THREAD_POOL_TASK_EXCUTOER,taskExecutor,wmStockService, corporations).start();
再実行、コンソール出力:
2016-08-01 13:52:46,518 [Thread-4] INFO  [com.alibaba.druid.pool.DruidDataSource] - {dataSource-1} closed
Exception in thread "pool-1-thread-8" Exception in thread "pool-1-thread-2" org.springframework.transaction.CannotCreateTransactionException: 
Could not open JDBC Connection for transaction; nested exception is com.alibaba.druid.pool.DataSourceDisableException
	at org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:241)
	at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:372)
	at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:417)
	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:255)
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
	at com.sun.proxy.$Proxy81.updateProductStockProcess(Unknown Source)
	at com.wlyd.fmcgwms.util.UpdateProductThread$DoBusinessThread.run(UpdateProductThread.java:71)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Caused by: com.alibaba.druid.pool.DataSourceDisableException
	at com.alibaba.druid.pool.DruidDataSource.pollLast(DruidDataSource.java:1399)
	at com.alibaba.druid.pool.DruidDataSource.getConnectionInternal(DruidDataSource.java:1021)
	at com.alibaba.druid.pool.DruidDataSource.getConnectionDirect(DruidDataSource.java:898)
	at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:882)
	at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:872)
	at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:97)
	at org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:203)
データ・ソースが早期にクローズされました.ここでは、データベース接続プールの問題が初歩的にわかります.次に、start()が呼び出されていないため、実際の問題点が見えませんでした.
5.Spring注入スレッドクラス処理
@serviceスキャンを使用してスレッド処理を再試行します.
package com.wlyd.fmcgwms.service.thread;

import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import javax.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Service;
import com.wlyd.fmcgwms.persistence.beans.Settings;
import com.wlyd.fmcgwms.persistence.beans.platform.Corporation;
import com.wlyd.fmcgwms.persistence.mapper.SettingsMapper;
import com.wlyd.fmcgwms.service.basic.WmStockService;
import com.wlyd.fmcgwms.util.base.BaseServiceImpl;
/**
 *         
 * 
 * @packge com.wlyd.fmcgwms.util.thread.UpdateProductThead
 * @date   2016 7 29     5:56:22
 * @author pengjunlin
 * @comment   
 * @update
 */
@Service
public class UpdateProductThead  extends BaseServiceImpl implements Runnable {
	
	public static final int THREAD_COMMON=0;
	
	public static final int THREAD_EXCUTOR_SERVICE=1;
	
	public static final int THREAD_POOL_TASK_EXCUTOER=2;
	
	@Autowired
	private ThreadPoolTaskExecutor taskExecutor;
	
	private ExecutorService executorService; 
	
	private WmStockService wmStockService;
	
	private List corporations;
	
	private int threadType;
	
	@Autowired
	private SettingsMapper settingsMapper;

	@PostConstruct
	public void init() {
		this.dao = settingsMapper;
	}
	
	public UpdateProductThead() {
		super();
	}

	public UpdateProductThead(int threadType,WmStockService wmStockService,List corporations) {
		this.wmStockService=wmStockService;
		this.corporations = corporations;
		this.executorService = Executors.newFixedThreadPool(corporations==null?0:corporations.size()); 
		this.threadType=threadType;
	}

	@Override
	public void run() {
		for (int i = 0; i < corporations.size(); i++) {
			switch (threadType) {
			case 0:
				//    
				new Thread(new DoBusinessThread(wmStockService,i));
				break;
			case 1:
				//    
				taskExecutor.execute(new DoBusinessThread(wmStockService,i));
				//new DoLogicThread(0).start();
				break;
			case 2:
				//    
				executorService.execute(new DoBusinessThread(wmStockService,i));
				break;
			default:
				break;
			}
			
		}
	}
	

	class DoBusinessThread extends Thread{
		
		WmStockService wmStockService;
		
		private int index=0;
		
		public DoBusinessThread(WmStockService wmStockService,int index){
			this.wmStockService=wmStockService;
			this.index=index;
		}

		@Override
		public void run() {
			wmStockService.updateProductStockProcess(corporations.get(index)); 
		}
		
	}
	
	class DoLogicThread extends Thread{
		
		private int index=0;
		
		public DoLogicThread(int index){
			this.index=index;
		}

		@Override
		public void run() {
			System.out.println("Do logic counting:"+index);
		}
		
	}

}
@Autowired
CorporationMapper corporationMapper;
    
@Autowired
WmStockService wmStockService;

@Test
public void testUpdateProductthread(){
	List corporations=corporationMapper.findAll();
	new Thread(new UpdateProductThead(UpdateProductThead.THREAD_POOL_TASK_EXCUTOER,wmStockService, corporations)).start();
}

スレッド がデータソース の であることを に し、コンソール は の りである.
2016-08-01 13:57:11,892 [Thread-4] INFO  [com.alibaba.druid.pool.DruidDataSource] - {dataSource-1} closed
Exception in thread "pool-1-thread-2" org.springframework.transaction.CannotCreateTransactionException: 
Could not open JDBC Connection for transaction; nested exception is com.alibaba.druid.pool.DataSourceDisableException
	at org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:241)
	at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:372)
	at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:417)
	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:255)
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
	at com.sun.proxy.$Proxy81.updateProductStockProcess(Unknown Source)
	at com.wlyd.fmcgwms.service.thread.UpdateProductThead$DoBusinessThread.run(UpdateProductThead.java:101)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Caused by: com.alibaba.druid.pool.DataSourceDisableException
	at com.alibaba.druid.pool.DruidDataSource.pollLast(DruidDataSource.java:1399)
	at com.alibaba.druid.pool.DruidDataSource.getConnectionInternal(DruidDataSource.java:1021)
	at com.alibaba.druid.pool.DruidDataSource.getConnectionDirect(DruidDataSource.java:898)
	at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:882)
	at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:872)
	at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:97)
	at org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:203)
	... 13 more
Exception in thread "pool-1-thread-4" org.springframework.transaction.CannotCreateTransactionException:
 Could not open JDBC Connection for transaction; nested exception is com.alibaba.druid.pool.DataSourceDisableException
	at org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:241)
	at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:372)
	at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:417)
	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:255)
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
	at com.sun.proxy.$Proxy81.updateProductStockProcess(Unknown Source)
	at com.wlyd.fmcgwms.service.thread.UpdateProductThead$DoBusinessThread.run(UpdateProductThead.java:101)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Caused by: com.alibaba.druid.pool.DataSourceDisableException
	at com.alibaba.druid.pool.DruidDataSource.pollLast(DruidDataSource.java:1399)
	at com.alibaba.druid.pool.DruidDataSource.getConnectionInternal(DruidDataSource.java:1021)
	at com.alibaba.druid.pool.DruidDataSource.getConnectionDirect(DruidDataSource.java:898)
	at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:882)
	at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:872)
	at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:97)
	at org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:203)
	... 13 more
Exception in thread "pool-1-thread-8" org.springframework.transaction.CannotCreateTransactionException:
 Could not open JDBC Connection for transaction; nested exception is com.alibaba.druid.pool.DataSourceDisableException
	at org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:241)
	at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:372)
	at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:417)
	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:255)
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
	at com.sun.proxy.$Proxy81.updateProductStockProcess(Unknown Source)
	at com.wlyd.fmcgwms.service.thread.UpdateProductThead$DoBusinessThread.run(UpdateProductThead.java:101)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Caused by: com.alibaba.druid.pool.DataSourceDisableException
	at com.alibaba.druid.pool.DruidDataSource.pollLast(DruidDataSource.java:1399)
	at com.alibaba.druid.pool.DruidDataSource.getConnectionInternal(DruidDataSource.java:1021)
	at com.alibaba.druid.pool.DruidDataSource.getConnectionDirect(DruidDataSource.java:898)
	at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:882)
	at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:872)
	at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:97)
	at org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:203)
	... 13 more
Exception in thread "pool-1-thread-6" org.springframework.transaction.CannotCreateTransactionException:
 Could not open JDBC Connection for transaction; nested exception is com.alibaba.druid.pool.DataSourceDisableException
	at org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:241)
	at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:372)
	at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:417)
	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:255)
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
	at com.sun.proxy.$Proxy81.updateProductStockProcess(Unknown Source)
	at com.wlyd.fmcgwms.service.thread.UpdateProductThead$DoBusinessThread.run(UpdateProductThead.java:101)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)

やっと が つかりました.データベース プールのマルチスレッド の です.
6.データベース プールの
 
    
      ${jdbc.driverClass}
    
    
      ${jdbc.jdbcUrl}
    
    
      ${jdbc.user}
    
    
      ${jdbc.password}
    
    
    
      20
    
    
    
      10
    
    
    
      60000
    
    
    
      20
    
    
    
      3
    
    
    
      true
    
    
    
      180
    
    
    
      clientEncoding=UTF-8
    
  

InitialSizeを1より きい に します( なのでデフォルトでは1に されています).
が するとテストが され、 が しました.コンソールの は のとおりです.
2016-08-01 14:21:30,815 [main] INFO  [org.quartz.core.QuartzScheduler] -
 JobFactory set to: org.springframework.scheduling.quartz.AdaptableJobFactory@29a23c3d
2016-08-01 14:21:30,824 [main] INFO  [org.springframework.context.support.DefaultLifecycleProcessor] - Starting beans in phase 2147483647
2016-08-01 14:21:30,824 [main] INFO  [org.springframework.scheduling.quartz.SchedulerFactoryBean] - Starting Quartz Scheduler now
2016-08-01 14:21:30,824 [main] INFO  [org.quartz.core.QuartzScheduler] - Scheduler SpringJobSchedulerFactoryBean_$_NON_CLUSTERED started.
2016-08-01 14:21:30,834 [main] DEBUG [java.sql.Connection] - ooo Using Connection [com.mysql.jdbc.JDBC4Connection@402f80f5]
2016-08-01 14:21:30,834 [main] DEBUG [java.sql.Connection] - ==> 
 Preparing: select ES_COR_ID, ES_COR_NAME,ES_COR_ALIAS, ES_COR_ADDRESS, ES_COR_JURIDICAL_PERSON, ES_COR_CONTACT_EMAIL, 
ES_COR_CONTACT_TEL,ES_COR_DESCRIBE, ES_COR_NOTE,ES_COR_CREATE_TIME,ES_COR_MODIFY_TIME from es_corporation 
2016-08-01 14:21:30,834 [main] DEBUG [java.sql.PreparedStatement] - ==> Parameters: 
2016-08-01 14:21:30,873 [pool-1-thread-2] DEBUG [java.sql.Connection] - ooo Using Connection [com.mysql.jdbc.JDBC4Connection@8c928a2]
2016-08-01 14:21:30,873 [pool-1-thread-6] DEBUG [java.sql.Connection] - ooo Using Connection [com.mysql.jdbc.JDBC4Connection@44290393]
2016-08-01 14:21:30,874 [pool-1-thread-2] DEBUG [java.sql.Connection] - ==> 
 Preparing: SELECT cd.CDSK_ITEM_CODE ProductCode,st.WMST_NOW_NUMBER ProductNum,
st.WMST_ENABLED_NUMBER AvailableProductNum,st.WMST_SKU_UNIT ProductUnit FROM wm_stock_10001 st 
LEFT JOIN cd_wh_itme_10001 cd ON cd.CD_ITEM_ID=st.WMST_SKU_ID GROUP BY st.WMST_SKU_NAME,st.WMST_SKU_UNIT 
2016-08-01 14:21:30,874 [pool-1-thread-6] DEBUG [java.sql.Connection] - ==> 
 Preparing: SELECT cd.CDSK_ITEM_CODE ProductCode,st.WMST_NOW_NUMBER ProductNum,
st.WMST_ENABLED_NUMBER AvailableProductNum,st.WMST_SKU_UNIT ProductUnit FROM wm_stock_10005 st
 LEFT JOIN cd_wh_itme_10005 cd ON cd.CD_ITEM_ID=st.WMST_SKU_ID GROUP BY st.WMST_SKU_NAME,st.WMST_SKU_UNIT 
2016-08-01 14:21:30,874 [pool-1-thread-6] DEBUG [java.sql.PreparedStatement] - ==> Parameters: 
2016-08-01 14:21:30,874 [pool-1-thread-1] DEBUG [java.sql.Connection] - ooo Using Connection [com.mysql.jdbc.JDBC4Connection@402f80f5]
2016-08-01 14:21:30,875 [pool-1-thread-1] DEBUG [java.sql.Connection] - ==>  
Preparing: SELECT cd.CDSK_ITEM_CODE ProductCode,st.WMST_NOW_NUMBER ProductNum,st.WMST_ENABLED_NUMBER AvailableProductNum,st.WMST_SKU_UNIT ProductUnit
 FROM wm_stock_10000 st LEFT JOIN cd_wh_itme_10000 cd ON cd.CD_ITEM_ID=st.WMST_SKU_ID GROUP BY st.WMST_SKU_NAME,st.WMST_SKU_UNIT 
2016-08-01 14:21:30,875 [pool-1-thread-1] DEBUG [java.sql.PreparedStatement] - ==> Parameters: 
2016-08-01 14:21:30,874 [pool-1-thread-5] DEBUG [java.sql.Connection] - ooo Using Connection [com.mysql.jdbc.JDBC4Connection@59fa1469]
2016-08-01 14:21:30,874 [pool-1-thread-2] DEBUG [java.sql.PreparedStatement] - ==> Parameters: 
2016-08-01 14:21:30,875 [pool-1-thread-5] DEBUG [java.sql.Connection] - ==> 
 Preparing: SELECT cd.CDSK_ITEM_CODE ProductCode,st.WMST_NOW_NUMBER ProductNum,st.WMST_ENABLED_NUMBER AvailableProductNum,st.WMST_SKU_UNIT ProductUnit
 FROM wm_stock_10004 st LEFT JOIN cd_wh_itme_10004 cd ON cd.CD_ITEM_ID=st.WMST_SKU_ID GROUP BY st.WMST_SKU_NAME,st.WMST_SKU_UNIT 
2016-08-01 14:21:30,875 [pool-1-thread-5] DEBUG [java.sql.PreparedStatement] - ==> Parameters: 
2016-08-01 14:21:30,876 [pool-1-thread-3] DEBUG [java.sql.Connection] - ooo Using Connection [com.mysql.jdbc.JDBC4Connection@177f3dab]
2016-08-01 14:21:30,876 [pool-1-thread-3] DEBUG [java.sql.Connection] - ==>
 Preparing: SELECT cd.CDSK_ITEM_CODE ProductCode,st.WMST_NOW_NUMBER ProductNum,st.WMST_ENABLED_NUMBER AvailableProductNum,st.WMST_SKU_UNIT ProductUnit
 FROM wm_stock_10002 st LEFT JOIN cd_wh_itme_10002 cd ON cd.CD_ITEM_ID=st.WMST_SKU_ID GROUP BY st.WMST_SKU_NAME,st.WMST_SKU_UNIT 
2016-08-01 14:21:30,876 [pool-1-thread-3] DEBUG [java.sql.PreparedStatement] - ==> Parameters: 
2016-08-01 14:21:30,878 [Thread-4] INFO  [org.springframework.context.support.GenericApplicationContext] 
- Closing org.springframework.context.support.GenericApplicationContext@7ac7a4e4: startup date [Mon Aug 01 14:21:27 CST 2016]; root of context hierarchy
2016-08-01 14:21:30,879 [Thread-4] INFO  [org.springframework.context.support.DefaultLifecycleProcessor] 
- Stopping beans in phase 2147483647
2016-08-01 14:21:30,880 [Thread-4] INFO  [org.quartz.core.QuartzScheduler] - Scheduler SpringJobSchedulerFactoryBean_$_NON_CLUSTERED paused.
2016-08-01 14:21:30,880 [Thread-4] INFO  [org.springframework.beans.factory.support.DefaultListableBeanFactory] 
- Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@4e08711f: defining beans [wmStockAlertRlueServiceImpl,wmWarringInfoServiceImpl,cdWarehouseServiceImpl,cdWhCustomerServiceImpl,cdWhItmeServiceImpl,cdWhLocAreaServiceImpl,cdWhLocationServiceImpl,wmStockAdjustServiceImpl,wmStockFreezeServiceImpl,wmStockReleaseServiceImpl,wmStockServiceImpl,esMenuFunctionsServiceImpl,esMrRightsServiceImpl,esMuRightsServiceImpl,WMWareHouseStatServiceImpl,esDictionaryServiceImpl,esDictionaryTypeServiceImpl,esExceptionServiceImpl,esIconsServiceImpl,esMenuServiceImpl,esPropertiesServiceImpl,esRoleServiceImpl,esUserServiceImpl,wmIntoOrderBatchCodenoServiceImpl,wmIntoOrderinfoServiceImpl,wmIntoOrderServiceImpl,wmReceiptServiceImpl,wmReturnInfoServiceImpl,wmInventorySheetDetailServiceImpl,wmInventorySheetServiceImpl,wmWarehouseMoveServiceImpl,ebInterfaceLogServiceImpl,ebIntoStockLogServiceImpl,ebOperateLogServiceImpl,ebOutStockLogServiceImpl,ebSysLogServiceImpl,wmBatchPickingServiceImpl,wmOutOrderDetailServiceImpl,wmOutOrderServiceImpl,APIForOMSServiceImpl,APIServiceImpl,corporationServiceImpl,esSaasServiceInfoServiceImpl,JZTDAPIServiceImpl,padServiceImpl,pdaApiImpl,quartzJobServiceImpl,statisticalChartsServiceImpl,stockWarringJobServiceImpl,syncOrderStutusServiceImpl,timerTaskServiceImpl,reportServiceImpl,wmItemDailyReportServiceImpl,cdWhUnpickServiceImpl,settingsServiceImpl,updateProductThead,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#0,dataSource,sqlSessionFactory,sqlSession,org.mybatis.spring.mapper.MapperScannerConfigurer#0,transactionManager,txAdvice,org.springframework.aop.config.internalAutoProxyCreator,pc,org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#0,InitSysProperties,DailyTaskJob,DailyTaskJobMethod,DailyTaskCronTriggerBean,DailyTaskJobMethodSaas,DailyTaskCronTriggerBeanSaas,StockWarringTaskJob,StockWarringTaskJobMethod,StockWarringTaskCronTriggerBean,CycleSendInterfaceInfoTaskJob,CycleSendInterfaceInfoTaskJobMethod,CycleSendInterfaceInfoTaskCronTriggerBean,SpringJobSchedulerFactoryBean,taskExecutor,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor,wmStockAlertRuleMapper,wmWarringInfoMapper,cdCustomerMapper,cdWarehouseMapper,cdWhItmeMapper,cdWhLocAreaMapper,cdWhLocationMapper,wmStockAdjustMapper,wmStockFreezeMapper,wmStockMapper,wmStockReleaseMapper,esMenuFunctionsMapper,esMrRightsMapper,esMuRightsMapper,esDictionaryMapper,esDictionaryTypeMapper,ebUserWarehouseMapper,esExceptionMapper,esIconsMapper,esMenuMapper,esPropertiesMapper,esRoleMapper,esUserMapper,wmIntoOrderBatchCodenoMapper,wmIntoOrderCodenoMapper,wmIntoOrderInfoMapper,wmIntoOrderMapper,wmReceiptInfoMapper,wmReturnInfoMapper,wmInventorySheetDetailMapper,wmInventorySheetMapper,wmWarehouseMoveCodenoMapper,wmWarehouseMoveMapper,ebInterfaceLogMapper,ebIntoStockLogMapper,ebOperateLogMapper,ebOutStockLogMapper,ebSysLogMapper,wmAssignedPickcarMapper,wmBatchPickingMapper,wmOutOrderCodenoMapper,wmOutOrderDetailMapper,wmOutOrderMapper,wmStockAssignedMapper,corporationMapper,esSaasServiceInfoMapper,statisticalChartsMapper,wmItemTransferMapper,reportMapper,wmDailyItemReportMapper,settingsMapper,wmUnpickMapper]; root of factory hierarchy
2016-08-01 14:21:30,880 [pool-1-thread-6] INFO  [com.wlyd.fmcgwms.service.basic.impl.WmStockServiceImpl] - >>>>  (10005)                  !!!
2016-08-01 14:21:30,884 [Thread-4] INFO  [org.springframework.scheduling.quartz.SchedulerFactoryBean] - Shutting down Quartz Scheduler
2016-08-01 14:21:30,884 [Thread-4] INFO  [org.quartz.core.QuartzScheduler] - Scheduler SpringJobSchedulerFactoryBean_$_NON_CLUSTERED shutting down.
2016-08-01 14:21:30,884 [Thread-4] INFO  [org.quartz.core.QuartzScheduler] - Scheduler SpringJobSchedulerFactoryBean_$_NON_CLUSTERED paused.
2016-08-01 14:21:30,884 [pool-1-thread-5] INFO  [com.wlyd.fmcgwms.service.basic.impl.WmStockServiceImpl] - >>>>  (10004)            !!!
2016-08-01 14:21:30,885 [pool-1-thread-9] DEBUG [java.sql.Connection] - ooo Using Connection [com.mysql.jdbc.JDBC4Connection@7086ced1]
2016-08-01 14:21:30,885 [pool-1-thread-9] DEBUG [java.sql.Connection] - ==>  Preparing: SELECT cd.CDSK_ITEM_CODE ProductCode,st.WMST_NOW_NUMBER ProductNum,st.WMST_ENABLED_NUMBER AvailableProductNum,st.WMST_SKU_UNIT ProductUnit FROM wm_stock_10008 st LEFT JOIN cd_wh_itme_10008 cd ON cd.CD_ITEM_ID=st.WMST_SKU_ID GROUP BY st.WMST_SKU_NAME,st.WMST_SKU_UNIT 
2016-08-01 14:21:30,885 [pool-1-thread-9] DEBUG [java.sql.PreparedStatement] - ==> Parameters: 
2016-08-01 14:21:30,888 [pool-1-thread-3] INFO  [com.wlyd.fmcgwms.service.basic.impl.WmStockServiceImpl] - >>>>  (10002)test      !!!
2016-08-01 14:21:30,888 [pool-1-thread-7] DEBUG [java.sql.Connection] - ooo Using Connection [com.mysql.jdbc.JDBC4Connection@767cef01]
2016-08-01 14:21:30,888 [pool-1-thread-7] DEBUG [java.sql.Connection] - ==>  Preparing: SELECT cd.CDSK_ITEM_CODE ProductCode,st.WMST_NOW_NUMBER ProductNum,st.WMST_ENABLED_NUMBER AvailableProductNum,st.WMST_SKU_UNIT ProductUnit FROM wm_stock_10006 st LEFT JOIN cd_wh_itme_10006 cd ON cd.CD_ITEM_ID=st.WMST_SKU_ID GROUP BY st.WMST_SKU_NAME,st.WMST_SKU_UNIT 
2016-08-01 14:21:30,892 [pool-1-thread-7] DEBUG [java.sql.PreparedStatement] - ==> Parameters: 
2016-08-01 14:21:30,895 [Thread-4] INFO  [org.quartz.core.QuartzScheduler] - Scheduler SpringJobSchedulerFactoryBean_$_NON_CLUSTERED shutdown complete.
2016-08-01 14:21:30,896 [Thread-4] INFO  [org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor] - Shutting down ExecutorService 'taskExecutor'
2016-08-01 14:21:30,900 [Thread-4] INFO  [com.alibaba.druid.pool.DruidDataSource] - {dataSource-1} closed
2016-08-01 14:21:30,901 [pool-1-thread-9] INFO  [com.wlyd.fmcgwms.service.basic.impl.WmStockServiceImpl] - >>>>  (10008)              !!!
2016-08-01 14:21:30,903 [pool-1-thread-7] INFO  [com.wlyd.fmcgwms.service.basic.impl.WmStockServiceImpl] - >>>>  (10006)test1      !!!

マルチスレッド クエリー:
2016-08-01 14:42:21,468 [pool-1-thread-5] INFO  [com.wlyd.fmcgwms.service.basic.impl.WmStockServiceImpl] - >>>>  (10004)            !!!
2016-08-01 14:42:21,468 [pool-1-thread-7] INFO  [com.wlyd.fmcgwms.service.basic.impl.WmStockServiceImpl] - >>>>  (10006)test1      !!!
2016-08-01 14:42:21,471 [pool-1-thread-2] ERROR [com.wlyd.fmcgwms.service.basic.impl.WmStockServiceImpl] - >>>>>>>>>>>>>>>>>   。。。。。。。。。。。。tenantCode:10001
2016-08-01 14:42:21,471 [pool-1-thread-3] INFO  [com.wlyd.fmcgwms.service.basic.impl.WmStockServiceImpl] - >>>>  (10002)test      !!!
2016-08-01 14:42:21,468 [pool-1-thread-8] INFO  [com.wlyd.fmcgwms.service.basic.impl.WmStockServiceImpl] - >>>>  (10007)aaabbbbbb      !!!
2016-08-01 14:42:21,475 [pool-1-thread-4] ERROR [com.wlyd.fmcgwms.service.basic.impl.WmStockServiceImpl] - >>>>>>>>>>>>>>>>>   。。。。。。。。。。。。tenantCode:10003
2016-08-01 14:42:21,470 [pool-1-thread-6] INFO  [com.wlyd.fmcgwms.service.basic.impl.WmStockServiceImpl] - >>>>  (10005)                  !!!
2016-08-01 14:42:21,479 [Thread-4] INFO  [com.alibaba.druid.pool.DruidDataSource] - {dataSource-1} closed

:5 では、 の は がstart()を なく いたので らないので、5 の みを いたのですが、 には く ありません. プログラミングするときは して、 なカーブを けましょう.
Springはバッチ のツールspring-batchに のある を し, のスキームに わることができる.