I have 2 general questions here:
Firstly, say I have 2 java programs running. Almost like a responder and an executor.
The executor can issues commands, requests and the such from the responder. I know it is possible to have them both packed as one program through multi-threading, but necessarily there might not be just 1 responder, there could be 3, maybe even 0 responders.
What is the best way for the 2 programs to ‘communicate’ such as a stream, implying I have no access to the other adapters?
The second question:
Is there a way to check to see if a Java program is open already? So if I run a program, I can’t run it a second time if the first is still running.
Thanks
You must explicitly code a socket-based solution. Today I guess REST would be the most obvious choice. A more heavyweight solution would be something JMS-based (involving a standalone message queue, also socked-based).
Yes, there is a way, but nothing out of the box. It usually involves creating temporary files that are checked for existence. There are some handy methods provided, like
createTemporaryFileanddeleteOnExitthat take care of the low-level work.