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.

93 lines
2.9 KiB

/* */ package com.archive.framework.manager;
/* */
/* */ import com.archive.framework.manager.AsyncManager;
/* */ import com.archive.framework.shiro.web.session.SpringSessionValidationScheduler;
/* */ import javax.annotation.PreDestroy;
/* */ import net.sf.ehcache.CacheManager;
/* */ import org.apache.shiro.cache.ehcache.EhCacheManager;
/* */ import org.slf4j.Logger;
/* */ import org.slf4j.LoggerFactory;
/* */ import org.springframework.beans.factory.annotation.Autowired;
/* */ import org.springframework.stereotype.Component;
/* */
/* */
/* */
/* */
/* */
/* */ @Component
/* */ public class ShutdownManager
/* */ {
/* 20 */ private static final Logger logger = LoggerFactory.getLogger("sys-user");
/* */
/* */ @Autowired(required = false)
/* */ private SpringSessionValidationScheduler springSessionValidationScheduler;
/* */
/* */ @Autowired(required = false)
/* */ private EhCacheManager ehCacheManager;
/* */
/* */
/* */ @PreDestroy
/* */ public void destroy() {
/* 31 */ shutdownSpringSessionValidationScheduler();
/* 32 */ shutdownAsyncManager();
/* 33 */ shutdownEhCacheManager();
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ private void shutdownSpringSessionValidationScheduler() {
/* 41 */ if (this.springSessionValidationScheduler != null && this.springSessionValidationScheduler.isEnabled()) {
/* */
/* */ try {
/* */
/* 45 */ logger.info("====关闭会话验证任务====");
/* 46 */ this.springSessionValidationScheduler.disableSessionValidation();
/* */ }
/* 48 */ catch (Exception e) {
/* */
/* 50 */ logger.error(e.getMessage(), e);
/* */ }
/* */ }
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */ private void shutdownAsyncManager() {
/* */ try {
/* 62 */ logger.info("====关闭后台任务任务线程池====");
/* 63 */ AsyncManager.me().shutdown();
/* */ }
/* 65 */ catch (Exception e) {
/* */
/* 67 */ logger.error(e.getMessage(), e);
/* */ }
/* */ }
/* */
/* */
/* */
/* */ private void shutdownEhCacheManager() {
/* */ try {
/* 75 */ logger.info("====关闭缓存====");
/* 76 */ if (this.ehCacheManager != null)
/* */ {
/* 78 */ CacheManager cacheManager = this.ehCacheManager.getCacheManager();
/* 79 */ cacheManager.shutdown();
/* */ }
/* */
/* 82 */ } catch (Exception e) {
/* */
/* 84 */ logger.error(e.getMessage(), e);
/* */ }
/* */ }
/* */ }
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\framework\manager\ShutdownManager.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/