org.pf4j.spring.boot.hooks.Pf4jShutdownHook Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spring-boot-starter-pf4j2 Show documentation
Show all versions of spring-boot-starter-pf4j2 Show documentation
Spring Boot Starter For Pf4j 2.x
package org.pf4j.spring.boot.hooks;
import org.pf4j.PluginManager;
public class Pf4jShutdownHook extends Thread {
private PluginManager pluginManager;
public Pf4jShutdownHook(PluginManager pluginManager) {
this.pluginManager = pluginManager;
}
@Override
public void run() {
// 销毁插件
if (pluginManager != null) {
/*
* 调用Plugin实现类的stop()方法
*/
pluginManager.stopPlugins();
}
}
}