Package net.mcreator.util
Class SingleAppHandler
java.lang.Object
net.mcreator.util.SingleAppHandler
- All Implemented Interfaces:
Closeable,AutoCloseable
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidbringToFront(JFrame frame) voidclose()booleanTries to acquire the single-instance lock.
-
Constructor Details
-
SingleAppHandler
- Parameters:
args- Command line args of this instancesecondaryAppLaunchedHandler- Called in the first instance when a secondary instance sends its args
-
-
Method Details
-
tryAcquireLock
public boolean tryAcquireLock()Tries to acquire the single-instance lock. If another instance is running, sends args to the first instance.- Returns:
- true if this is the first instance (or if locking completely fails), false if another instance is already running
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
bringToFront
-