java Procrun与org。阿帕奇。平民守护进程。守护进程
我使用apache commons示例代码编写了一个守护程序:
public class LockDaemon implements Daemon {
@Override
public void init(DaemonContext context) throws DaemonInitException, Exception {
LogManager.getLogger().info("initialized with arguments {}", context.getArguments());
}
@Override
public void start() throws Exception {
LogManager.getLogger().info("Start called");
}
@Override
public void stop() throws Exception {
LogManager.getLogger().info("Stop called");
}
@Override
public void destroy() {
}
}
不幸的是,这个例子没有提到如何用ProCurn安装这个类。Procrun需要一个静态的“启动方法”,我在使用上面的代码时没有这个方法
那么,为了让上面的代码正常工作,需要为procrun设置哪个启动(和停止)方法呢
# 1 楼答案
这个问题将在本帖中进一步讨论:Howto setup a Daemon implementation as windows service