根据当前的源代码,我什至认为它不应该运行第二个副本。main
功能是:
public static void main(String[] args) throws Exception {
File root = new File(System.getProperty("application.path"));
if (System.getProperty("precompiled", "false").equals("true")) {
Play.usePrecompiled = true;
}
if (System.getProperty("writepid", "false").equals("true")) {
writePID(root);
}
:
blah blah blah
}
并且writePID
是:
private static void writePID(File root) {
String pid = ManagementFactory.getRuntimeMXBean().getName().split("@")[0];
File pidfile = new File(root, PID_FILE);
if (pidfile.exists()) {
throw new RuntimeException("The " + PID_FILE + " already exists. Is the server already running?");
}
IO.write(pid.getBytes(), pidfile);
}
这意味着当您尝试使用相同的application.path
.
因此,要么您没有使用我正在查看的版本,要么您正在讨论其他内容。
在我看来,更改上面的一行将是一件简单的事情:
File root = new File(System.getProperty("application.path"));
为 PID 文件存储使用不同的属性,该属性不在共享驱动器上。
尽管您需要小心,但root
也会传递给,Play.int
因此您应该调查更改它的影响。
毕竟,这是开源软件的一大优势,因为您可以自己修复“错误”。
对于它的价值,我不是您选择的部署方法的忠实粉丝。是的,它简化了部署,但是升级你的服务器是一个全有或全无的事情,如果你不小心安装了一些狡猾的软件,这会让你感到悲伤。
我更喜欢分阶段部署,因此我可以根据需要关闭性能不佳的节点。