1. 0.3.2 启动锁 #2

Merged
jianguo merged 1 commits from dev into master 2024-06-04 15:14:03 +08:00
2 changed files with 17 additions and 2 deletions

View File

@ -6,7 +6,7 @@
<groupId>org.aohe</groupId>
<artifactId>sane-service</artifactId>
<version>0.3.1</version>
<version>0.3.2</version>
<name>aohe-sane-service</name>
@ -71,6 +71,12 @@
<version>3.4.1</version>
<classifier>no-natives</classifier>
</dependency>
<dependency>
<groupId>io.github.sanyarnd</groupId>
<artifactId>app-locker</artifactId>
<version>1.2.0</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>com.formdev</groupId>-->
<!-- <artifactId>flatlaf</artifactId>-->

View File

@ -1,6 +1,7 @@
package org.aohe;
import com.formdev.flatlaf.FlatDarculaLaf;
import io.github.sanyarnd.applocker.AppLocker;
import lombok.extern.slf4j.Slf4j;
import org.aohe.core.sane.utils.SaneSessionUtils;
import org.aohe.core.swing.NewWindow;
@ -14,13 +15,21 @@ import javax.swing.*;
public class Main {
public static void main(String[] args) {
log.info(" 当前系统类型: {}", SystemUtils.getOsName());
try {
try (AppLocker locker = AppLocker.create("aoheSaneServiceLock").build()){
//启动锁只允许启动一个
locker.lock();
//设置窗口主题
//FlatLightLaf.setup();
UIManager.setLookAndFeel(new FlatDarculaLaf());
} catch (UnsupportedLookAndFeelException e) {
throw new RuntimeException(e);
} catch (Exception ex) {
log.info("应用已经启动,当前进程退出。");
System.exit(0);
}
//初始化其他资源
init();