Too much of "Looks like another instance is already running." #5584
This commit is contained in:
parent
01372c9bb6
commit
d6da0c3ce0
|
@ -6,7 +6,7 @@ import java.net.URL;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
public class rusEFIVersion {
|
public class rusEFIVersion {
|
||||||
public static final int CONSOLE_VERSION = 20230917;
|
public static final int CONSOLE_VERSION = 20230925;
|
||||||
public static AtomicReference<String> firmwareVersion = new AtomicReference<>("N/A");
|
public static AtomicReference<String> firmwareVersion = new AtomicReference<>("N/A");
|
||||||
|
|
||||||
public static long classBuildTimeMillis() {
|
public static long classBuildTimeMillis() {
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
package com.rusefi.ui.util;
|
package com.rusefi.ui.util;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.PrintWriter;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.net.ServerSocket;
|
import java.net.ServerSocket;
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class is used to figure out if we have multiple instances of rusEfi console running
|
* This class is used to figure out if we have multiple instances of rusEfi console running
|
||||||
*
|
* <p>
|
||||||
* Andrey Belomutskiy, (c) 2013-2020
|
* Andrey Belomutskiy, (c) 2013-2020
|
||||||
* 5/4/2015
|
* 5/4/2015
|
||||||
*/
|
*/
|
||||||
|
@ -39,8 +40,7 @@ public class JustOneInstance {
|
||||||
while (true) {
|
while (true) {
|
||||||
// Wait for a connection
|
// Wait for a connection
|
||||||
Socket clientSocket = serverSocket.accept();
|
Socket clientSocket = serverSocket.accept();
|
||||||
// System.out.println("*** Got a connection! ");
|
handleConnection(clientSocket);
|
||||||
clientSocket.close();
|
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
}
|
}
|
||||||
|
@ -48,4 +48,11 @@ public class JustOneInstance {
|
||||||
};
|
};
|
||||||
new Thread(runnable, "JustOneInstance").start();
|
new Thread(runnable, "JustOneInstance").start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void handleConnection(Socket clientSocket) throws IOException {
|
||||||
|
try (clientSocket) {
|
||||||
|
PrintWriter out = new PrintWriter(clientSocket.getOutputStream(), true);
|
||||||
|
out.println(new java.util.Date() + "Already running " + ProcessHandle.current().pid() + "\r\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue