Наметил локальный вариант, но пока не уверен что он приоритетен..
This commit is contained in:
@@ -9,6 +9,7 @@ import TestingSystem.DVM.DVMPackage.DVMPackage;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.InetAddress;
|
||||
import java.util.Vector;
|
||||
public class MachineProcess extends DBObject {
|
||||
public String id = "";
|
||||
@@ -32,7 +33,7 @@ public class MachineProcess extends DBObject {
|
||||
userWorkspace = p.user_workspace;
|
||||
testingSystemRoot = Global.Home;
|
||||
serverName = Global.testingServer.name;
|
||||
id = Utils.getDateName(machineAddress+"_"+machinePort+"_"+userName);
|
||||
id = Utils.getDateName(machineAddress + "_" + machinePort + "_" + userName);
|
||||
}
|
||||
@Override
|
||||
public Object getPK() {
|
||||
@@ -76,6 +77,19 @@ public class MachineProcess extends DBObject {
|
||||
File started = getStartedFile();
|
||||
return started.exists();
|
||||
}
|
||||
public boolean isLocal() {
|
||||
boolean local = false;
|
||||
try {
|
||||
InetAddress address = InetAddress.getByName(machineAddress);
|
||||
InetAddress localAddress = InetAddress.getByName(Global.properties.ServerAddress);
|
||||
System.out.println("machine ip=" + Utils.Brackets(address.getHostAddress()));
|
||||
System.out.println("server ip=" + Utils.Brackets(localAddress.getHostAddress()));
|
||||
local = localAddress.getHostAddress().equals(address.getHostAddress());
|
||||
} catch (Exception ex) {
|
||||
Global.Log.PrintException(ex);
|
||||
}
|
||||
return local;
|
||||
}
|
||||
//--
|
||||
public void Start() {
|
||||
try {
|
||||
@@ -87,7 +101,8 @@ public class MachineProcess extends DBObject {
|
||||
FileUtils.copyFile(src, supervisor);
|
||||
//создание настроек
|
||||
GlobalProperties properties = new GlobalProperties(Global.properties);
|
||||
properties.Mode = Current.Mode.MachineQueue;
|
||||
properties.Mode = //isLocal()?Current.Mode.LocalMachineQueue:
|
||||
Current.Mode.MachineQueue;
|
||||
Utils.jsonToFile(properties, new File(workspace, "properties"));
|
||||
Vector<String> args = new Vector<>();
|
||||
args.add(Utils.DQuotes(machineAddress));
|
||||
@@ -101,7 +116,7 @@ public class MachineProcess extends DBObject {
|
||||
Utils.startScript(workspace, workspace,
|
||||
"start",
|
||||
"java -jar VisualSapfor.jar " +
|
||||
String.join(" ", args)+" 1>out.txt 2>err.txt");
|
||||
String.join(" ", args) + " 1>out.txt 2>err.txt");
|
||||
//---
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
|
||||
Reference in New Issue
Block a user