增加afterbladestop方法

This commit is contained in:
zhuangqian 2017-01-06 08:36:04 +08:00
parent 32903b6622
commit db0efd8a52
3 changed files with 21 additions and 0 deletions

View File

@ -86,4 +86,11 @@ public class WebConfig implements IConfig {
System.out.println(DateKit.getMsTime() + " after blade start, you can do something~~~~~~~~~~~~~~~~");
}
/**
* 工程关闭执行逻辑
*/
public void afterBladeStop() {
}
}

View File

@ -43,4 +43,9 @@ public interface IConfig {
*/
void afterBladeStart();
/**
* 程序关闭之后执行
*/
void afterBladeStop();
}

View File

@ -19,6 +19,7 @@ import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextClosedEvent;
import org.springframework.stereotype.Component;
import com.smallchill.core.config.BladeConfig;
import com.smallchill.core.plugins.PluginManager;
/**
@ -31,6 +32,7 @@ public class StopListener implements ApplicationListener<ContextClosedEvent> {
public void onApplicationEvent(ContextClosedEvent event) {
if (event.getApplicationContext().getParent() == null) {
destroyPlugin();
afterBladeStop();
}
}
@ -40,5 +42,12 @@ public class StopListener implements ApplicationListener<ContextClosedEvent> {
private void destroyPlugin() {
PluginManager.init().stop();
}
/**
* 系统关闭后执行
*/
private void afterBladeStop(){
BladeConfig.getConf().afterBladeStop();
}
}