You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							39 lines
						
					
					
						
							841 B
						
					
					
				
			
		
		
	
	
							39 lines
						
					
					
						
							841 B
						
					
					
				package com.ruoyi.framework.manager; | 
						|
 | 
						|
import org.slf4j.Logger; | 
						|
import org.slf4j.LoggerFactory; | 
						|
import org.springframework.stereotype.Component; | 
						|
import javax.annotation.PreDestroy; | 
						|
 | 
						|
/** | 
						|
 * 确保应用退出时能关闭后台线程 | 
						|
 * | 
						|
 * @author ruoyi | 
						|
 */ | 
						|
@Component | 
						|
public class ShutdownManager | 
						|
{ | 
						|
    private static final Logger logger = LoggerFactory.getLogger("sys-user"); | 
						|
 | 
						|
    @PreDestroy | 
						|
    public void destroy() | 
						|
    { | 
						|
        shutdownAsyncManager(); | 
						|
    } | 
						|
 | 
						|
    /** | 
						|
     * 停止异步执行任务 | 
						|
     */ | 
						|
    private void shutdownAsyncManager() | 
						|
    { | 
						|
        try | 
						|
        { | 
						|
            logger.info("====关闭后台任务任务线程池===="); | 
						|
            AsyncManager.me().shutdown(); | 
						|
        } | 
						|
        catch (Exception e) | 
						|
        { | 
						|
            logger.error(e.getMessage(), e); | 
						|
        } | 
						|
    } | 
						|
}
 | 
						|
 |