How to create a real singleton for a whole computer in Java?
I have a console app written in Java. if application is executed for a second time I want it to know that the main application is already running (and executing jobs). The second execution will just allow the user to query data (jobs). I know I can create a file and write everything to it, but then I will have to also support computer resets, etc.
Is there a better way to do it?
to summarize:
P.S. I do know this question must have been asked more then once, but google and StackOverflow search give me links only relative to Singleton Design Pattern.
Here is a link that'll do what you want.
This provides an example of code that binds to a socket at startup and then if something is bound at startup then it sends a message
You can use this to communitcate between your processes.