C
C
Clean Coder2020-04-29 12:46:08
Java
Clean Coder, 2020-04-29 12:46:08

How to guarantee the uniqueness of an application instance?

Hello. The question is. Let's say I have an application running in the background, App.jar. If I call this jar 4 times, then 4 instances of the same program will hang in my memory, respectively. How can I make sure that only one instance of the program can run at a time?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
alfss, 2020-04-29
@alfss

Lock files, systemd

D
danbulochkin, 2020-04-29
@danbulochkin

How about adding a check that looks into processes and looks for a process, and if it's already there, doesn't start a new jar?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question