I need to pass a signal from a .NET app to a Java app. No data is required, the signal itself is enough.
The most simple way that comes to my mind is by using a named synchronization object like this:
- The .NET app creates a certain named synchronization object A.
- The Java app creates a certain named synchronization object A – the name is the same as in (1).
- The Java app has a thread waiting on the object to become signaled.
- The .NET app signals the object.
- The Java app thread awakens and acts upon the signal reception.
At least, this how I would do it if I knew how to create a named synchronization object in Java.
But looks like Java does not have any, which I find hard to believe. Does it mean that only Windows has named synchronization objects?
So, my question is this – how do I pass a simple signal (no data) from a non Java app to a Java app on Windows? Both processes run on the same host.
EDIT
Motivation – I want to signal to our headless Java process to terminate itself gracefully as soon as it can do so.
For God’s sake, I just want a single 1 bit signal from a C++/C# process to a Java process and there is no simple way to do it. I can’t believe it.
Forget about it, I’ll just use the file system. The C++/C# code is going to create an empty file at a well known location, which the Java code is going to poll every second.
Finito, end of story.