-
Notifications
You must be signed in to change notification settings - Fork 0
only one instance
Jaeyong Park edited this page Aug 3, 2018
·
2 revisions
멤버변수 생성
/** 앱 중복실행방지용 */
private static ServerSocket onlyOncInstanceSocket;
main 시작할때 소켓 열수 있는지 확인
public static void main(String[] args) {
try {
onlyOncInstanceSocket = new ServerSocket(65535, 1, InetAddress.getLocalHost());
System.out.println("[main] First run. Keep this Processor");
} catch (Exception e) {
System.out.println("[main] Duplicated run. Exit Program");
return;
}