--- a/src/jdk.jpackage/share/native/libapplauncher/PosixPlatform.cpp Mon Jan 07 16:43:30 2019 -0500
+++ b/src/jdk.jpackage/share/native/libapplauncher/PosixPlatform.cpp Tue Jan 08 07:37:14 2019 -0500
@@ -54,9 +54,6 @@
}
PosixPlatform::~PosixPlatform(void) {
- if (!SingleInstanceFile.empty()) {
- unlink(SingleInstanceFile.c_str());
- }
}
TString PosixPlatform::GetTempDirectory() {
@@ -82,43 +79,6 @@
return fixedName;
}
-// returns true if another instance is already running.
-// if false, we need to continue regular launch.
-bool PosixPlatform::CheckForSingleInstance(TString appName) {
- TString tmpDir = GetTempDirectory();
- if (tmpDir.empty()) {
- printf("Unable to check for single instance.\n");
- return false;
- }
-
- TString lockFile = tmpDir + "/" + fixName(appName);
- SingleInstanceFile = lockFile;
- int pid_file = open(lockFile.c_str(), O_CREAT | O_RDWR, 0666);
- int rc = flock(pid_file, LOCK_EX | LOCK_NB);
-
- if (rc) {
- if (EWOULDBLOCK == errno) {
- // another instance is running
- pid_t pid = 0;
- read(pid_file, (void*)&pid, sizeof(pid_t));
- printf("Another instance is running PID: %d\n", pid);
- if (pid != 0) {
- singleInstanceProcessId = pid;
- SingleInstanceFile.clear();
- return true;
- }
- } else {
- printf("Unable to check for single instance.\n");
- }
- } else {
- // It is the first instance.
- pid_t pid = getpid();
- write(pid_file, (void*)&pid, sizeof(pid_t));
- }
-
- return false;
-}
-
MessageResponse PosixPlatform::ShowResponseMessage(TString title,
TString description) {
MessageResponse result = mrCancel;